-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.common.cjs
More file actions
61 lines (57 loc) · 1.71 KB
/
Copy pathwebpack.common.cjs
File metadata and controls
61 lines (57 loc) · 1.71 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
const path = require('path');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; // This is useful for explaining large builds, but not needed for most runs
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const config = require('./package.json');
const exportFileName = path.basename(config.main, path.extname(config.main));
module.exports = {
mode: 'production',
entry: path.resolve(__dirname, './src/app/browser.js'),
output: {
path: path.resolve(__dirname, 'dist/'),
filename: `${exportFileName}.js`,
libraryTarget: 'umd',
library: exportFileName,
},
externals: {},
module: {
// Make sure to load the source maps for any dependent libraries
rules: [
{
test: /\.js$/,
loader: 'source-map-loader',
enforce: 'pre',
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.wasm$/,
type: 'javascript/auto',
loader: 'file-loader',
},
],
},
plugins: [
new CleanWebpackPlugin({
verbose: true,
cleanOnceBeforeBuildPatterns: ['**/*'],
}),
new CopyWebpackPlugin({
patterns: [
path.resolve(__dirname, 'src/app/', 'mvtdstpack.wasm')
],
}),
new FriendlyErrorsWebpackPlugin(),
// new BundleAnalyzerPlugin(),
],
devtool: 'source-map',
node: { // Reduce build size bloat by skipping certain emscripten library shims. TODO: Verify this doesn't break integral.js!
fs: 'empty',
path: 'empty',
crypto: 'empty',
},
};