Created
April 24, 2019 09:31
-
-
Save PaulRBerg/9ea000d2f9b1a1aaa7b078db8c5038da to your computer and use it in GitHub Desktop.
Webpack Common Config File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CleanWebpackPlugin = require('clean-webpack-plugin'); | |
const path = require('path'); | |
const webpack = require('webpack'); | |
module.exports = { | |
entry: './src/index.js', | |
module: { | |
rules: [ | |
{ | |
enforce: 'pre', | |
test: /\.js$/, | |
include: /^[^node_modules]+(src|test)/, | |
use: 'eslint-loader', | |
}, | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', | |
options: { | |
cacheDirectory: true, | |
rootMode: 'upward', | |
}, | |
}, | |
{ | |
test: /\.wasm$/, | |
exclude: /node_modules/, | |
loader: 'wasm-loader', | |
}, | |
], | |
}, | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
library: 'aztec', | |
libraryTarget: 'umd', | |
}, | |
performance: { | |
hints: 'warning', | |
maxAssetSize: 200000, | |
maxEntrypointSize: 400000, | |
}, | |
plugins: [ | |
new CleanWebpackPlugin(), | |
new webpack.DefinePlugin({ | |
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), | |
'process.env.WEBPACK_ENV': JSON.stringify(true), | |
}), | |
], | |
resolve: { | |
extensions: ['.js'], | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment