-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.prod.js
64 lines (63 loc) · 1.42 KB
/
webpack.prod.js
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
var path = require('path');
const webpack = require('webpack');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
entry: './src/index.js',
mode: 'production',
devtool: false,
performance: {
maxEntrypointSize: 2048000,
maxAssetSize: 2048000
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
globalObject: "this",
// one day we might need "library" instead of "libraryTarget"
// https://github.com/webpack/webpack/issues/11800
library: {
type: 'commonjs-static',
},
libraryTarget: 'commonjs2',
hashFunction: "xxhash64"
},
externals: {},
module: {
rules: [
{
test: /\.m?js$/,
include: path.join(__dirname, 'src'),
exclude: path.join(__dirname, '/node_modules/'),
loader: 'babel-loader',
options: {
plugins: ['@babel/plugin-proposal-optional-chaining'],
},
},
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto'
}
]
},
resolve: {
fallback: {
fs: false,
string_decoder: false,
crypto: false,
},
alias: {
process: "process/browser"
}
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
new NodePolyfillPlugin()
],
target: 'node'
};