-
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 1 commit
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 |
---|---|---|
|
@@ -11,28 +11,28 @@ | |
"scripts": { | ||
"start": "webpack-dev-server --hot --inline", | ||
"build": "rimraf dist && webpack && mv dist/*.eot dist/static/css/ && mv dist/*.woff* dist/static/css/ && mv dist/*.svg dist/static/css/ && mv dist/*.ttf dist/static/css/", | ||
"reinstall": "npm i rimraf && rimraf node_modules && npm uninstall -g elm && npm i -g elm && npm i && elm package install" | ||
"reinstall": "npm i rimraf && rimraf elm-stuff && rimraf node_modules && npm i && elm package install" | ||
}, | ||
"devDependencies": { | ||
"autoprefixer": "^6.3.6", | ||
"bootstrap-sass": "^3.3.6", | ||
"copy-webpack-plugin": "^4.0.1", | ||
"css-loader": "^0.26.1", | ||
"css-loader": "^0.26.2", | ||
"elm": "^0.18.0", | ||
"elm-hot-loader": "^0.5.4", | ||
"elm-webpack-loader": "^4.1.1", | ||
"extract-text-webpack-plugin": "^1.0.1", | ||
"file-loader": "^0.9.0", | ||
"html-webpack-plugin": "^2.17.0", | ||
"elm-webpack-loader": "^4.2.0", | ||
"extract-text-webpack-plugin": "^2.0.0", | ||
"file-loader": "^0.10.1", | ||
"html-webpack-plugin": "^2.28.0", | ||
"jquery": "^3.1.0", | ||
"node-sass": "^4.2.0", | ||
"postcss-loader": "^1.1.1", | ||
"rimraf": "^2.5.2", | ||
"sass-loader": "^4.0.0", | ||
"sass-loader": "^6.0.0", | ||
"style-loader": "^0.13.1", | ||
"url-loader": "^0.5.7", | ||
"webpack": "^1.13.1", | ||
"webpack-dev-server": "^1.14.1", | ||
"webpack-merge": "^2.4.0" | ||
"webpack": "^2.2.1", | ||
"webpack-dev-server": "^2.4.1", | ||
"webpack-merge": "^3.0.0" | ||
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. About 2 hours ago |
||
} | ||
} |
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' | ||
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 think this should still be |
||
} | ||
] | ||
}, | ||
|
@@ -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'm not a huge fan of IDE and OS specific stuff in project's
.gitignore
files. Imo this sort of things should be handled in a global.gitignore
per machine. But after all that's just personal taste, so definitely up for discussion.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.
agree :) It is better to enable global
.gitignore
with commandgit config --global core.excludesfile ~/.gitignore_global
.