-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade to webpack 2 #53
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
plugins: [ | ||
require('autoprefixer')( { browsers: ['last 2 versions'] } ) | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,20 +19,20 @@ var commonConfig = { | |
|
||
output: { | ||
path: outputPath, | ||
filename: `/static/js/${outputFilename}`, | ||
// publicPath: '/' | ||
filename: `static/js/${outputFilename}`, | ||
publicPath: '/' | ||
}, | ||
|
||
resolve: { | ||
extensions: ['', '.js', '.elm'] | ||
extensions: ['.js', '.elm'] | ||
}, | ||
|
||
module: { | ||
noParse: /\.elm$/, | ||
loaders: [ | ||
rules: [ | ||
{ | ||
test: /\.(eot|ttf|woff|woff2|svg)$/, | ||
loader: 'file-loader' | ||
use: 'file-loader' | ||
} | ||
] | ||
}, | ||
|
@@ -45,8 +45,6 @@ var commonConfig = { | |
}) | ||
], | ||
|
||
postcss: [ autoprefixer( { browsers: ['last 2 versions'] } ) ], | ||
|
||
} | ||
|
||
// additional webpack settings for local env (when invoked by 'npm start') | ||
|
@@ -67,15 +65,15 @@ if ( TARGET_ENV === 'development' ) { | |
}, | ||
|
||
module: { | ||
loaders: [ | ||
rules: [ | ||
{ | ||
test: /\.elm$/, | ||
exclude: [/elm-stuff/, /node_modules/], | ||
loader: 'elm-hot!elm-webpack?verbose=true&warn=true&debug=true' | ||
loader: 'elm-hot-loader!elm-webpack-loader?verbose=true&warn=true&debug=true' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably use the new "array of object"-syntax use: [
{
loader: 'elm-hot-loader'
},
{
loader: 'elm-webpack-loader',
options: {
verbose: true,
debug: true,
warn: true,
}
}
] |
||
}, | ||
{ | ||
test: /\.(css|scss)$/, | ||
loaders: [ | ||
use: [ | ||
'style-loader', | ||
'css-loader', | ||
'postcss-loader', | ||
|
@@ -97,19 +95,24 @@ if ( TARGET_ENV === 'production' ) { | |
entry: entryPath, | ||
|
||
module: { | ||
loaders: [ | ||
rules: [ | ||
{ | ||
test: /\.elm$/, | ||
exclude: [/elm-stuff/, /node_modules/], | ||
loader: 'elm-webpack' | ||
use: 'elm-webpack-loader' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See other comment |
||
}, | ||
{ | ||
test: /\.(css|scss)$/, | ||
loader: ExtractTextPlugin.extract( 'style-loader', [ | ||
'css-loader', | ||
'postcss-loader', | ||
'sass-loader' | ||
]) | ||
use: ExtractTextPlugin.extract( | ||
{ | ||
fallback: "style-loader", | ||
use: [ | ||
'css-loader', | ||
'postcss-loader', | ||
'sass-loader' | ||
], | ||
allChunks: true | ||
}) | ||
} | ||
] | ||
}, | ||
|
@@ -125,10 +128,10 @@ if ( TARGET_ENV === 'production' ) { | |
}, | ||
]), | ||
|
||
new webpack.optimize.OccurenceOrderPlugin(), | ||
new webpack.optimize.OccurrenceOrderPlugin(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is on by default and can therefore be removed |
||
|
||
// extract CSS into a separate file | ||
new ExtractTextPlugin( 'static/css/[name]-[hash].css', { allChunks: true } ), | ||
new ExtractTextPlugin( 'static/css/[name]-[hash].css'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if plain filename is supported, nor why you removed new ExtractTextPlugin({
filename: 'static/css/[name]-[hash].css',
allChunks: true
}) |
||
|
||
// minify & mangle JS/CSS | ||
new webpack.optimize.UglifyJsPlugin({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should still be
loader
. Check the// Do not use "use" here
comment in the code block at https://webpack.js.org/guides/migrating/#module-loaders-is-now-module-rules