Created
April 26, 2016 17:53
-
-
Save allizad/f78f58cc0cfe5797129df4410052748c to your computer and use it in GitHub Desktop.
webpack config for searchkit history error
This file contains hidden or 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 webpack = require('webpack'); | |
/* | |
* Default webpack configuration for development | |
*/ | |
var config = { | |
devtool: 'eval-source-map', | |
entry: [ __dirname + "/app/App.js", 'bootstrap-loader'], | |
output: { | |
path: __dirname + "/public", | |
filename: "bundle.js" | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /node_modules/, | |
loader: 'babel', | |
query: { | |
presets: ['es2015','react'] | |
} | |
}, | |
{ | |
test: /\.scss$/, | |
loaders: ["style", "css", "sass"] | |
}, | |
{ | |
test: /\.css$/, // Only .css files | |
loader: 'style!css' // Run both loaders | |
}, | |
{ test: /\.(woff2?|svg)$/, loader: 'url?limit=10000' }, | |
{ test: /\.(ttf|eot)$/, loader: 'file' }, | |
] | |
}, | |
devServer: { | |
contentBase: "./public", | |
colors: true, | |
historyApiFallback: true, | |
inline: true | |
}, | |
} | |
/* | |
* If bundling for production, optimize output | |
*/ | |
if (process.env.NODE_ENV === 'production') { | |
config.devtool = false; | |
config.plugins = [ | |
new webpack.optimize.OccurenceOrderPlugin(), | |
new webpack.optimize.UglifyJsPlugin({comments: 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