Skip to content

Commit f933481

Browse files
committed
Add webpack config for prod
1 parent 91dc119 commit f933481

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"build": "webpack",
7-
"build:prod": "webpack --mode=production",
7+
"build:prod": "webpack --config ./webpack.prod.config.js",
88
"clean": "rimraf build && jlpm run clean:static",
99
"clean:static": "rimraf -g \"../notebook/static/!(favicons)\"",
1010
"watch": "webpack --config ./webpack.config.watch.js"

app/webpack.prod.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) Jupyter Development Team.
3+
* Distributed under the terms of the Modified BSD License.
4+
*/
5+
6+
const merge = require('webpack-merge').default;
7+
const config = require('./webpack.config');
8+
const WPPlugin = require('@jupyterlab/builder').WPPlugin;
9+
10+
config[0] = merge(config[0], {
11+
mode: 'production',
12+
devtool: 'source-map',
13+
output: {
14+
// Add version argument when in production so the Jupyter server
15+
// allows caching of files (i.e., does not set the CacheControl header to no-cache to prevent caching static files)
16+
filename: '[name].[contenthash].js?v=[contenthash]'
17+
},
18+
optimization: {
19+
minimize: false
20+
},
21+
plugins: [
22+
new WPPlugin.JSONLicenseWebpackPlugin({
23+
excludedPackageTest: packageName =>
24+
packageName === '@jupyterlab/application-top'
25+
})
26+
]
27+
});
28+
29+
module.exports = config;

0 commit comments

Comments
 (0)