-
Notifications
You must be signed in to change notification settings - Fork 75
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
Switch to webpack v3. #854
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
var UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | ||
|
||
module.exports = { | ||
/* webpack 4 | ||
mode: 'production', | ||
*/ | ||
performance: {hints: false}, | ||
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. what does this do? 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. It suppresses certain warning messages. Webpack, for instance, complains that the proj4 inclusion is large and could be broken into smaller modules, but we want proj4 as it stands, so this is not a useful warning. Rather than see this on every build, this turns those warnings off. 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. thanks |
||
cache: true, | ||
context: path.join(__dirname, 'src'), | ||
entry: { | ||
'geo.ext': './vendor.js', | ||
|
@@ -18,18 +23,41 @@ module.exports = { | |
hammerjs: 'hammerjs/hammer.js' | ||
} | ||
}, | ||
/* webpack 3 */ | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
new UglifyJsPlugin({ | ||
include: /\.min\.js$/, | ||
minimize: true, | ||
comments: /@(license|copyright)/ | ||
parallel: true, | ||
uglifyOptions: { | ||
compress: true, | ||
comments: /@(license|copyright)/ | ||
}, | ||
sourceMap: true | ||
}) | ||
], | ||
/* end webpack 3 */ | ||
/* webpack 4 | ||
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. are we keeping commented code for the future work? |
||
optimization: { | ||
minimizer: [ | ||
new UglifyJsPlugin({ | ||
include: /\.min\.js$/, | ||
parallel: true, | ||
uglifyOptions: { | ||
compress: true, | ||
comments: /@(license|copyright)/ | ||
}, | ||
sourceMap: true | ||
}) | ||
] | ||
}, | ||
*/ | ||
module: { | ||
loaders: [{ | ||
test: require.resolve('d3'), loader: 'expose?d3' | ||
rules: [{ | ||
test: require.resolve('d3'), | ||
use: ['expose-loader?d3'] | ||
}, { | ||
test: require.resolve('hammerjs'), loader: 'expose?hammerjs' | ||
test: require.resolve('hammerjs'), | ||
use: ['expose-loader?hammerjs'] | ||
}] | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,13 +41,11 @@ module.exports = function (config) { | |
{type: 'text'} | ||
] | ||
}; | ||
karma_config.webpack.module.preLoaders = [ | ||
{ | ||
test: /\.js$/, | ||
include: path.resolve('src/'), | ||
loader: 'istanbul-instrumenter' | ||
} | ||
]; | ||
karma_config.webpack.module.rules.unshift({ | ||
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. what is the difference between preloaders vs unshift? 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. looks like API change. 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.
|
||
test: /\.js$/, | ||
include: path.resolve('src/'), | ||
use: ['istanbul-instrumenter-loader'] | ||
}); | ||
|
||
config.set(karma_config); | ||
}; |
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 believe it should be "webpack 3" - assuming this was left over
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.
There is some preliminary work to use webpack 4 that is commented out. I can remove it, but wanted to preserve it in some commit for when we move to webpack 4. Unfortunately, karma-webpack is not webpack 4 compatible yet.
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.
that is fine. I was just making sure.