diff --git a/package.json b/package.json index 6da0a80294..f3f5f2cab5 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,15 @@ "scripts": { "bower": "bower install", "build": "python setup.py js css", - "build:webpack": "webpack --mode development", + "build:webpack": "webpack --mode production", "build:watch": "npm run watch", "watch": "onchange 'notebook/static/**/!(*.min).js' 'notebook/static/**/*.less' 'bower.json' -- npm run build" }, "devDependencies": { + "@babel/preset-env": "^7.15.0", "@jupyterlab/apputils": "^3.1.3", + "babel-loader": "^8.2.2", + "babel-polyfill": "^6.26.0", "bower": "^1.8.8", "less": "~2", "onchange": "^6.0.0", diff --git a/webpack.config.js b/webpack.config.js index eb440b77d2..83c8a214ca 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,10 +1,27 @@ const path = require('path'); module.exports = { - entry: '@jupyterlab/apputils/lib/sanitizer', + entry: ['babel-polyfill', '@jupyterlab/apputils/lib/sanitizer'], output: { filename: 'index.js', path: path.resolve(__dirname, 'notebook/static/components/sanitizer'), - libraryTarget: "amd" + libraryTarget: "amd", + }, + devtool: false, + optimization: { + minimize: false + }, + module: { + rules: [ + { + test: /\.m?jsx?$/, + use: { + loader: 'babel-loader', + options: { + presets: ['@babel/preset-env'], + } + } + } + ] } }