Created
November 7, 2017 05:31
-
-
Save amackintosh/3b057990b6c25d2c19a69abf05856039 to your computer and use it in GitHub Desktop.
SCSS Webpack Config
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
const webpack = require('webpack'); | |
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const preferEntry = true; | |
module.exports = { | |
entry: ['babel-polyfill', './src/root.js'], | |
output: { | |
path: `${__dirname}/dist`, | |
publicPath: '/', | |
filename: 'bundle.js' | |
}, | |
devtool: 'inline-source-map', | |
module: { | |
loaders: [ | |
{ | |
exclude: /node_modules/, | |
loader: 'babel-loader', | |
query: { presets: ['react', 'es2015', 'stage-1'] } | |
}, | |
{ | |
test: /\.(png|jpg)$/, | |
loader: 'url-loader?limit=8192' | |
}, | |
{ | |
test: /\.scss$/, | |
loader: 'style-loader!css-loader!sass-loader?modules&localIdentName=[name]---[local]---[hash:base64:5]' | |
}, | |
] | |
}, | |
plugins: [ | |
// http://jpsierens.com/tutorial-react-redux-webpack/ | |
// new HtmlWebpackPlugin({ | |
// template: 'app/index.tpl.html', | |
// inject: 'body', | |
// filename: 'index.html' | |
// }), | |
new ExtractTextPlugin({ | |
filename: 'css/[name]-[chunkhash].css', | |
disable: false, | |
allChunks: true | |
}), | |
new webpack.optimize.OccurrenceOrderPlugin(preferEntry), | |
new webpack.DefinePlugin({ | |
'process.env.NODE_ENV': JSON.stringify('development') | |
}) | |
//new SWPrecacheWebpackPlugin(), | |
], | |
resolve: { | |
extensions: ['.js', '.jsx'] | |
}, | |
devServer: { | |
hot: false, | |
historyApiFallback: true, | |
contentBase: './', | |
port: 1337 | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment