Merge pull request #152 from madebr/webpack2

Upgrade webpack example in documentation to webpack v2
This commit is contained in:
Joseph Nix 2018-01-17 17:10:21 -06:00 committed by GitHub
commit e201fc8c75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 8 deletions

View File

@ -107,25 +107,28 @@ module.exports = {
},
devtool: '#cheap-module-source-map',
resolve: {
modulesDirectories: ['node_modules'],
extensions: ['', '.js']
modules: ['node_modules'],
extensions: ['.js']
},
module: {
loaders: [
rules: [
{ test: /\.js$/, exclude: /node_modules/,
loader: 'babel-loader' },
{ test: /\.scss$/,
loader: ExtractTextPlugin.extract(
'style-loader', 'css-loader!sass-loader') },
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader!sass-loader' } ) },
{ test: /\.css$/,
loader: ExtractTextPlugin.extract(
'style-loader', 'css-loader') },
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader' } ) },
{ test: /\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/,
loader: 'file' }
]
},
plugins: [
new ExtractTextPlugin('styles.css', {
new ExtractTextPlugin({
filename: 'styles.css',
allChunks: true
}),
new webpack.optimize.UglifyJsPlugin()