Skip to content

Instantly share code, notes, and snippets.

@ethanhinson
Created November 14, 2018 15:51
Show Gist options
  • Save ethanhinson/0b0643bef695ed67fbd173b76c77177a to your computer and use it in GitHub Desktop.
Save ethanhinson/0b0643bef695ed67fbd173b76c77177a to your computer and use it in GitHub Desktop.
Webpack Define plugin example
const merge = require('webpack-merge');
const webpack = require('webpack');
const prod = require('./webpack.prod');
module.exports = merge(prod, {
plugins: [
new webpack.DefinePlugin({
foo: JSON.stringify('bar'),
someProps: JSON.stringify({
one: 2,
buckle: true,
myShoe: false,
aNested: {
object: {
object2: 'foo',
},
},
}),
}),
],
output: {
path: `${__dirname}/public/with-opts`,
publicPath: '/',
filename: 'bundle.js',
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment