Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Created April 24, 2019 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulRBerg/9ea000d2f9b1a1aaa7b078db8c5038da to your computer and use it in GitHub Desktop.
Save PaulRBerg/9ea000d2f9b1a1aaa7b078db8c5038da to your computer and use it in GitHub Desktop.
Webpack Common Config File
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