-
-
Save lcfd/216d0d42a861136240db8fe546be6d79 to your computer and use it in GitHub Desktop.
All kinds of webpack configs. [ normal, react + .babelrc ]
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
Show hidden characters
{ | |
"presets": ["react", "es2015", "stage-0"] | |
} |
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
module.exports = { | |
entry: './src/index.js', | |
output: { | |
path: './build', | |
filename: 'bundle.js' | |
} | |
} |
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
var debug = process.env.NODE_ENV !== "production"; | |
var path = require('path'); | |
var webpack = require('webpack'); | |
var config = { | |
devtool: 'cheap-module-source-map', | |
entry: ['./src/main.js'], | |
output: { | |
path: path.join(__dirname, 'dist'), | |
filename: 'bundle.js', | |
publicPath: '/dist/' | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.js$/, | |
loaders: ['babel'], | |
exclude: /node_modules/ | |
} | |
] | |
}, | |
plugins: [ | |
new webpack.optimize.DedupePlugin(), | |
new webpack.optimize.OccurenceOrderPlugin(), | |
new webpack.optimize.UglifyJsPlugin({ | |
compress: { | |
warnings: false | |
} | |
}), | |
new webpack.DefinePlugin({ | |
'process.env': { | |
'NODE_ENV': JSON.stringify('production') | |
} | |
}) | |
] | |
}; | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment