Skip to content

Commit

Permalink
Merge pull request #19 from eclipse-theia/test-prod
Browse files Browse the repository at this point in the history
Build browser app in production mode for performance workflow
  • Loading branch information
tortmayr authored Sep 28, 2023
2 parents 74011f2 + 527cf70 commit b8173cd
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,27 @@ jobs:
with:
repository: eclipse-theia/theia
path: ./theia

- name: Copy webpack config
shell: bash
run: |
cp -f ./configs/theia.production.webpack.config.js ./theia/examples/browser/webpack.config.js
- name: Build Theia
shell: bash
working-directory: ./theia
run: |
yarn --skip-integrity-check --network-timeout 100000
yarn download:plugins
yarn browser build
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Build Browser App (Production)
shell: bash
working-directory: ./theia/examples/browser
run: |
yarn -s compile && yarn rebuild && yarn theia build --mode=production
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9
- name: Run Theia
shell: bash
working-directory: ./theia
Expand Down
45 changes: 45 additions & 0 deletions configs/theia.production.webpack.config.js
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
];

0 comments on commit b8173cd

Please sign in to comment.