-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build browser app in production mode for performance workflow
Performance measurements might vary drastically in dev vs. production mode. We are mostly interested in production performance -> update performance workflow to use browser app in production mode. Contributed on behalf of ST Microelectronics
- Loading branch information
Showing
2 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* This file can be edited to customize webpack configuration. | ||
* To reset delete this file and rerun theia build again. | ||
*/ | ||
// @ts-check | ||
const configs = require('./gen-webpack.config.js'); | ||
const nodeConfig = require('./gen-webpack.node.config.js'); | ||
const TerserPlugin = require('terser-webpack-plugin'); | ||
|
||
/** | ||
* Expose bundled modules on window.theia.moduleName namespace, e.g. | ||
* window['theia']['@theia/core/lib/common/uri']. | ||
* Such syntax can be used by external code, for instance, for testing. | ||
*/ | ||
configs[0].module.rules.push({ | ||
test: /\.js$/, | ||
loader: require.resolve('@theia/application-manager/lib/expose-loader') | ||
}); | ||
|
||
configs[0].optimization = { | ||
minimizer: [ | ||
new TerserPlugin({ | ||
terserOptions: { | ||
keep_classnames: true | ||
} | ||
}) | ||
] | ||
}; | ||
|
||
if (nodeConfig.config.optimization) { | ||
nodeConfig.config.optimization.minimizer = [ | ||
new TerserPlugin({ | ||
terserOptions: { | ||
keep_classnames: true | ||
}, | ||
exclude: /^(lib|builtins)\// | ||
}) | ||
] | ||
} | ||
|
||
|
||
module.exports = [ | ||
...configs, | ||
nodeConfig.config | ||
]; |