Skip to content

Commit eae52fd

Browse files
committed
Update dependencies & webpack compatibility (BREAKING CHANGES)
1 parent e6f2f49 commit eae52fd

File tree

5 files changed

+69
-6053
lines changed

5 files changed

+69
-6053
lines changed

assets/build/config.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const path = require('path');
22
const argv = require('minimist')(process.argv.slice(2));
33
const glob = require('glob-all');
4-
const merge = require('lodash/merge');
54

65
const mergeWithConcat = require('./util/mergeWithConcat');
76
const userConfig = require('../config');
@@ -30,19 +29,20 @@ const config = mergeWithConcat({
3029
watch: [],
3130
}, userConfig);
3231

32+
const files = glob.sync(config.copy, {
33+
cwd: config.paths.assets,
34+
mark: true,
35+
}).filter(file => !((file.slice(-1) === '/') || (!file.indexOf('*') === -1)))
36+
.map(file => path.join(config.paths.assets, file));
37+
3338
Object.keys(config.entry).forEach(id =>
3439
config.entry[id].unshift(path.join(__dirname, 'public-path.js')));
3540

3641
module.exports = mergeWithConcat(config, {
37-
env: merge({ production: isProduction, development: !isProduction }, argv.env),
38-
entry: {
39-
get files() {
40-
return glob.sync(config.copy, {
41-
cwd: config.paths.assets,
42-
mark: true,
43-
}).filter(file => !((file.slice(-1) === '/') || (!file.indexOf('*') === -1)))
44-
.map(file => path.join(config.paths.assets, file));
45-
},
46-
},
42+
env: Object.assign({ production: isProduction, development: !isProduction }, argv.env),
4743
publicPath: `${config.publicPath}/${path.basename(config.paths.dist)}/`,
4844
});
45+
46+
if (files.length) {
47+
module.exports = mergeWithConcat(module.exports, { entry: { files } });
48+
}

assets/build/webpack.config.js

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@ const webpackConfig = {
4242
filename: `scripts/${assetsFilenames}.js`,
4343
},
4444
module: {
45-
preLoaders: [
45+
rules: [
46+
jsLoader,
4647
{
48+
enforce: 'pre',
4749
test: /\.js?$/,
4850
include: config.paths.assets,
4951
loader: 'eslint',
5052
},
51-
],
52-
loaders: [
53-
jsLoader,
5453
{
5554
test: /\.css$/,
5655
include: config.paths.assets,
@@ -110,12 +109,14 @@ const webpackConfig = {
110109
},
111110
],
112111
},
113-
modules: [
114-
config.paths.assets,
115-
'node_modules',
116-
'bower_components',
117-
],
118-
enforceExtensions: false,
112+
resolve: {
113+
modules: [
114+
config.paths.assets,
115+
'node_modules',
116+
'bower_components',
117+
],
118+
enforceExtension: false,
119+
},
119120
externals: {
120121
jquery: 'jQuery',
121122
},
@@ -163,18 +164,21 @@ const webpackConfig = {
163164
minimize: config.enabled.minify,
164165
debug: config.enabled.watcher,
165166
stats: { colors: true },
166-
postcss: [
167-
autoprefixer({
168-
browsers: [
169-
'last 2 versions',
170-
'android 4',
171-
'opera 12',
172-
],
173-
}),
174-
],
175-
eslint: {
176-
failOnWarning: false,
177-
failOnError: true,
167+
}),
168+
new webpack.LoaderOptionsPlugin({
169+
test: /\.s?css$/,
170+
options: {
171+
output: { path: config.paths.dist },
172+
context: config.paths.assets,
173+
postcss: [
174+
autoprefixer({ browsers: ['last 2 versions', 'android 4', 'opera 12'] }),
175+
],
176+
},
177+
}),
178+
new webpack.LoaderOptionsPlugin({
179+
test: /\.js$/,
180+
options: {
181+
eslint: { failOnWarning: false, failOnError: true },
178182
},
179183
}),
180184
],
@@ -187,9 +191,8 @@ if (config.env.production) {
187191
}
188192

189193
if (config.enabled.watcher) {
190-
module.exports = mergeWithConcat(webpackConfig, webpackConfigWatch, {
191-
entry: addHotMiddleware(webpackConfig.entry),
192-
});
194+
module.exports.entry = addHotMiddleware(webpackConfig.entry);
195+
module.exports = mergeWithConcat(webpackConfig, webpackConfigWatch);
193196
}
194197

195198
if (config.enabled.uglifyJs) {

assets/build/webpack.config.watch.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const config = require('./config');
66

77
module.exports = {
88
output: { pathinfo: true },
9-
debug: true,
109
devtool: '#cheap-module-source-map',
1110
plugins: [
1211
new webpack.optimize.OccurrenceOrderPlugin(),

package.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,53 +29,53 @@
2929
"node": ">= 4.5"
3030
},
3131
"devDependencies": {
32-
"assets-webpack-plugin": "^3.4.0",
33-
"autoprefixer": "^6.4.1",
34-
"babel-cli": "^6.14.0",
35-
"babel-core": "^6.14.0",
36-
"babel-eslint": "^6.1.2",
37-
"babel-loader": "^6.2.5",
38-
"babel-preset-es2015": "^6.14.0",
39-
"babel-register": "^6.14.0",
40-
"babel-runtime": "^6.11.6",
32+
"assets-webpack-plugin": "^3.5.0",
33+
"autoprefixer": "^6.5.1",
34+
"babel-cli": "^6.18.0",
35+
"babel-core": "^6.18.2",
36+
"babel-eslint": "^7.1.0",
37+
"babel-loader": "^6.2.7",
38+
"babel-preset-es2015": "^6.18.0",
39+
"babel-register": "^6.18.0",
40+
"babel-runtime": "^6.18.0",
4141
"body-parser": "^1.15.2",
42-
"browser-sync": "^2.15.0",
43-
"clean-webpack-plugin": "^0.1.10",
42+
"browser-sync": "^2.17.5",
43+
"clean-webpack-plugin": "^0.1.13",
4444
"css-loader": "^0.25.0",
45-
"cssnano": "^3.7.4",
46-
"eslint": "^3.5.0",
47-
"eslint-config-airbnb": "^11.0.0",
48-
"eslint-config-airbnb-es5": "^1.0.9",
49-
"eslint-loader": "^1.5.0",
50-
"eslint-plugin-import": "^1.14.0",
51-
"eslint-plugin-jsx-a11y": "^2.2.1",
52-
"eslint-plugin-react": "^6.2.0",
45+
"cssnano": "^3.8.0",
46+
"eslint": "^3.9.1",
47+
"eslint-config-airbnb": "^12.0.0",
48+
"eslint-config-airbnb-es5": "^1.1.0",
49+
"eslint-loader": "^1.6.1",
50+
"eslint-plugin-import": "^2.0.1",
51+
"eslint-plugin-jsx-a11y": "^2.2.3",
52+
"eslint-plugin-react": "^6.5.0",
5353
"extract-text-webpack-plugin": "^2.0.0-beta.4",
5454
"file-loader": "^0.9.0",
5555
"glob-all": "^3.1.0",
5656
"imagemin-mozjpeg": "^6.0.0",
57-
"imagemin-webpack-plugin": "^1.1.0",
57+
"imagemin-webpack-plugin": "^1.2.1",
5858
"imports-loader": "^0.6.5",
59-
"lodash": "^4.15.0",
59+
"lodash": "^4.16.6",
6060
"minimist": "^1.2.0",
6161
"monkey-hot-loader": "github:rmarscher/monkey-hot-loader#webpack2-import",
62-
"node-sass": "^3.9.3",
62+
"node-sass": "^3.11.0",
6363
"optimize-css-assets-webpack-plugin": "^1.3.0",
64-
"postcss": "^5.2.0",
65-
"postcss-loader": "^0.13.0",
66-
"qs": "^6.2.1",
64+
"postcss": "^5.2.5",
65+
"postcss-loader": "^1.1.0",
66+
"qs": "^6.3.0",
6767
"resolve-url-loader": "^1.6.0",
6868
"rimraf": "^2.5.4",
6969
"sass-loader": "^4.0.2",
7070
"style-loader": "^0.13.1",
7171
"url-loader": "^0.5.7",
72-
"webpack": "2.1.0-beta.22",
73-
"webpack-dev-middleware": "^1.7.0",
74-
"webpack-hot-middleware": "^2.12.2"
72+
"webpack": "^2.1.0-beta.25",
73+
"webpack-dev-middleware": "^1.8.4",
74+
"webpack-hot-middleware": "^2.13.1"
7575
},
7676
"dependencies": {
77-
"bootstrap": "github:twbs/bootstrap#v4-dev",
78-
"font-awesome": "^4.6.3",
77+
"bootstrap": "^4.0.0-alpha.5",
78+
"font-awesome": "^4.7.0",
7979
"jquery": "1.12.4 - 3"
8080
}
8181
}

0 commit comments

Comments
 (0)