Skip to content

Commit

Permalink
Add webpack config for prod
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed Oct 15, 2024
1 parent faee9e4 commit dcca490
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "webpack",
"build:prod": "webpack --mode=production",
"build:prod": "webpack --config ./webpack.prod.config.js",
"clean": "rimraf build && jlpm run clean:static",
"clean:static": "rimraf -g \"../notebook/static/!(favicons)\"",
"watch": "webpack --config ./webpack.config.watch.js"
Expand Down
29 changes: 29 additions & 0 deletions app/webpack.prod.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
*/

const merge = require('webpack-merge').default;
const config = require('./webpack.config');
const WPPlugin = require('@jupyterlab/builder').WPPlugin;

config[0] = merge(config[0], {
mode: 'production',
devtool: 'source-map',
output: {
// Add version argument when in production so the Jupyter server
// allows caching of files (i.e., does not set the CacheControl header to no-cache to prevent caching static files)
filename: '[name].[contenthash].js?v=[contenthash]'
},
optimization: {
minimize: false
},
plugins: [
new WPPlugin.JSONLicenseWebpackPlugin({
excludedPackageTest: packageName =>
packageName === '@jupyterlab/application-top'
})
]
});

module.exports = config;

0 comments on commit dcca490

Please sign in to comment.