-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathwebpack.config.js
More file actions
69 lines (65 loc) · 2.16 KB
/
webpack.config.js
File metadata and controls
69 lines (65 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const path = require('path');
const crypto = require('crypto');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// Workaround for loaders using "md4" by default, which is not supported in FIPS-compliant OpenSSL
// See https://github.com/jupyterlab/jupyterlab/issues/11248
const cryptoOrigCreateHash = crypto.createHash;
crypto.createHash = (algorithm) =>
cryptoOrigCreateHash(algorithm == 'md4' ? 'sha256' : algorithm);
const mainConfig = {
name: 'mainConfig',
entry: ['babel-polyfill', '@jupyterlab/apputils/lib/sanitizer'],
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'nbclassic/static/components/sanitizer'),
libraryTarget: "amd",
},
devtool: false,
optimization: {
minimize: false
},
module: {
rules: [
{
test: /\.m?jsx?$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
}
}
}
]
}
}
const nb6Config = {
name: 'nb6Config',
mode: 'production',
entry: {},
plugins: [
new CopyWebpackPlugin({
patterns: [
// Same content, different path/name for NB6-style consumers:
{
from: path.resolve(__dirname, 'nbclassic/static/components/react/umd/react.production.min.js'),
to: path.resolve(__dirname, 'nbclassic/static/components/react/react.production.min.js'),
},
{
from: path.resolve(__dirname, 'nbclassic/static/components/react-dom/umd/react-dom.production.min.js'),
to: path.resolve(__dirname, 'nbclassic/static/components/react/react-dom.production.min.js'),
},
{
from: path.resolve(__dirname, 'nbclassic/static/components/es6-promise/dist/promise-1.0.0.min.js'),
to: path.resolve(__dirname, 'nbclassic/static/components/es6-promise/promise.min.js'),
},
{
from: path.resolve(__dirname, 'nbclassic/static/components/jquery/dist/jquery.min.js'),
to: path.resolve(__dirname, 'nbclassic/static/components/jquery/jquery.min.js'),
}
],
}),
],
// ensure this runs after 'main'
dependencies: ['mainConfig'],
};
module.exports = [mainConfig, nb6Config];