Skip to content

Instantly share code, notes, and snippets.

@Omar-Gonzalez
Created November 9, 2018 14:34
Show Gist options
  • Save Omar-Gonzalez/6830004c0ec54b4f76a3d4b026fd4059 to your computer and use it in GitHub Desktop.
Save Omar-Gonzalez/6830004c0ec54b4f76a3d4b026fd4059 to your computer and use it in GitHub Desktop.
react-django-webpack config
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry:[
'./app.jsx'
],
output:{
filename:'../pecsa.bundle.js'
},
module:{
loaders:[
{
test:/\.js[x]?$/,
loader:'babel-loader',
exclude:/(node_modules)/,
query:{
presets:['es2015','react']
}
}
]
},
plugins: [
//Minify build
new UglifyJsPlugin(),
//build production
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
//expose jquery window global
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
tether: 'tether',
Tether: 'tether',
'window.Tether': 'tether',
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment