You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
// http://www.jonathan-petitcolas.com/2015/05/15/howto-setup-webpack-on-es6-react-application-with-sass.html
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
function getEntrySources() {
|
|
var sources = [
|
|
'./index.js'
|
|
];
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
sources.push('webpack-dev-server/client?http://localhost:8080');
|
|
//sources.push('webpack/hot/only-dev-server');
|
|
}
|
|
|
|
return sources;
|
|
}
|
|
|
|
module.exports = {
|
|
entry: getEntrySources(),
|
|
|
|
module: {
|
|
loaders: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: __dirname + '/node_modules',
|
|
loader: 'babel',
|
|
query: {
|
|
presets: ['react', 'es2015']
|
|
}
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
include: __dirname + '/sass',
|
|
loader: ExtractTextPlugin.extract('css!sass')
|
|
}
|
|
]
|
|
},
|
|
|
|
output: {
|
|
path: __dirname,
|
|
filename: 'bundle.js'
|
|
},
|
|
|
|
plugins: [
|
|
new ExtractTextPlugin('style.css', {
|
|
allChunks: true
|
|
})
|
|
]
|
|
};
|
|
|