-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.js
35 lines (33 loc) · 1.14 KB
/
webpack.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
const webpack = require('webpack')
const path = require('path')
const appName = process.env.npm_package_name
const buildMode = process.env.NODE_ENV
const isDev = buildMode === 'development'
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
module.exports = {
target: 'web',
context: __dirname + "/src",
entry: {
fileAction: path.resolve(path.join('src', 'fileAction.js')),
init: path.resolve(path.join('src', 'init.js')),
},
output: {
path: __dirname + "/js",
publicPath: path.join('/apps/', appName, '/js/'),
clean: false,
filename: `[name].js?v=[contenthash]`,
chunkFilename: `[name].js?v=[contenthash]`,
},
devtool: isDev ? 'cheap-source-map' : 'source-map',
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser.js',
}),
// Make sure we auto-inject node polyfills on demand
// https://webpack.js.org/blog/2020-10-10-webpack-5-release/#automatic-nodejs-polyfills-removed
new NodePolyfillPlugin({
// Console is available in the web-browser
excludeAliases: ['console'],
}),
]
}