Migrate build pipeline to Webpack 2

This commit is contained in:
squidfunk
2017-02-11 16:00:45 +01:00
committed by Martin Donath
parent 7c36b5c4ef
commit 80fe7e010d
8 changed files with 219 additions and 281 deletions

View File

@@ -50,12 +50,13 @@ export default (gulp, config, args) => {
],
output: {
filename: "application.js",
library: "Application"
library: "app",
libraryTarget: "window"
},
module: {
/* Transpile ES6 to ES5 with Babel */
loaders: [
rules: [
{
loader: "babel-loader",
test: /\.jsx?$/
@@ -65,7 +66,7 @@ export default (gulp, config, args) => {
plugins: [
/* Don't emit assets that include errors */
new webpack.NoErrorsPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
/* Provide JSX helper */
new webpack.ProvidePlugin({
@@ -77,19 +78,30 @@ export default (gulp, config, args) => {
args.optimize ? [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
warnings: false,
screw_ie8: true, // eslint-disable-line camelcase
conditionals: true,
unused: true,
comparisons: true,
sequences: true,
dead_code: true, // eslint-disable-line camelcase
evaluate: true,
if_return: true, // eslint-disable-line camelcase
join_vars: true // eslint-disable-line camelcase
},
output: {
comments: false
}
})
] : []),
/* Module resolver */
resolve: {
modulesDirectories: [
modules: [
"src/assets/javascripts",
"node_modules"
],
extensions: [
"",
".js",
".jsx"
]
@@ -102,7 +114,7 @@ export default (gulp, config, args) => {
/* Sourcemap support */
devtool: args.sourcemaps ? "inline-source-map" : ""
}))
}, webpack))
/* Revisioning */
.pipe(gulpif(args.revision, rev()))