Skip to content
This repository was archived by the owner on May 21, 2020. It is now read-only.

Commit 2f2c890

Browse files
committed
fix(webpack): validations errors
1 parent 87b59b8 commit 2f2c890

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

webpack/webpack.client.config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable no-undefined, object-shorthand */
22

3+
const path = require('path')
34
const config = require('../config/config')
45
const merge = require('lodash.merge')
56
const paths = require('../config/paths')
@@ -37,7 +38,8 @@ const webpackClientConfig = merge({}, webpackConfig, {
3738
{
3839
test: /\.css$/,
3940
loader: `style!css?modules${DEBUG ? '&localIdentName=[name]_[local]_[hash:base64:3]' : ''}!postcss`,
40-
exclude: /node_modules/
41+
exclude: /node_modules/,
42+
include: path.resolve('.')
4143
}
4244
])
4345
},
@@ -52,10 +54,6 @@ const webpackClientConfig = merge({}, webpackConfig, {
5254
name: config.inlineName,
5355
filename: `${config.inlineName}.js`
5456
}),
55-
new webpack.LoaderOptionsPlugin({
56-
minimize: true,
57-
debug: false
58-
}),
5957
new webpack.optimize.UglifyJsPlugin({
6058
sourceMap: false,
6159
output: {

webpack/webpack.config.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,23 @@ const GLOBALS = {
1414

1515
const plugins = [
1616
new webpack.NoErrorsPlugin(),
17-
new webpack.DefinePlugin(GLOBALS)
17+
new webpack.DefinePlugin(GLOBALS),
18+
new webpack.LoaderOptionsPlugin({
19+
minimize: !DEBUG,
20+
debug: DEBUG,
21+
options: {
22+
context: paths.contextDir,
23+
postcss: [
24+
require('autoprefixer')({ browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'IE 10'] })
25+
]
26+
}
27+
})
1828
]
1929

2030
const webpackConfig = {
2131
cache: DEBUG,
2232
context: paths.contextDir,
2333
bail: !DEBUG,
24-
debug: DEBUG,
2534
devtool: DEBUG ? 'eval' : undefined,
2635
output: {
2736
publicPath: '/',
@@ -41,31 +50,27 @@ const webpackConfig = {
4150
}
4251
]
4352
},
44-
postcss: [
45-
require('autoprefixer')({ browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'IE 10'] }),
46-
],
4753
resolve: {
4854
modules: ['shared', 'node_modules'],
4955
extensions: [
50-
'',
5156
'.web.js',
5257
'.js',
5358
'.json',
5459
'.jsx'
5560
]
5661
},
5762
stats: {
58-
// assets: VERBOSE,
63+
assets: false,
5964
cached: VERBOSE,
6065
cachedAssets: VERBOSE,
6166
children: VERBOSE,
6267
chunkModules: VERBOSE,
6368
chunks: VERBOSE,
6469
colors: true,
65-
// context: VERBOSE,
70+
context: false,
6671
hash: VERBOSE,
6772
modules: VERBOSE,
68-
reasons: VERBOSE,
73+
reasons: true,
6974
source: VERBOSE,
7075
timings: true,
7176
version: VERBOSE,

webpack/webpack.server.config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable no-undefined, object-shorthand */
22

3+
const path = require('path')
34
const webpack = require('webpack')
45
const config = require('../config/config')
56
const merge = require('lodash.merge')
@@ -8,6 +9,8 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
89
const webpackConfig = require('./webpack.config.js')
910
const DEBUG = config.DEBUG
1011

12+
const extractCSS = new ExtractTextPlugin({ filename: paths.styleSheet, disable: false, allChunks: true })
13+
1114
//
1215
// Server Config
1316
// -----------------------------------------------------------------------------
@@ -24,19 +27,16 @@ const webpackServerConfig = merge({}, webpackConfig, {
2427
loaders: webpackConfig.module.loaders.concat([
2528
{
2629
test: /\.css$/,
27-
loader: ExtractTextPlugin.extract({ fallbackLoader: 'style', loader: `css?modules${DEBUG ? '&localIdentName=[name]_[local]_[hash:base64:3]' : '&minimize'}!postcss` }),
28-
exclude: /node_modules/
30+
loader: extractCSS.extract({ fallbackLoader: 'style', loader: `css?modules${DEBUG ? '&localIdentName=[name]_[local]_[hash:base64:3]' : '&minimize'}!postcss` }),
31+
exclude: /node_modules/,
32+
include: path.resolve('.')
2933
}
3034
])
3135
},
3236
plugins: webpackConfig.plugins.concat(
3337
new webpack.DefinePlugin({ __BROWSER__: false }),
34-
new ExtractTextPlugin({ filename: paths.styleSheet, disable: false, allChunks: true })
38+
extractCSS
3539
).concat(DEBUG ? [] : [
36-
new webpack.LoaderOptionsPlugin({
37-
minimize: true,
38-
debug: false
39-
}),
4040
new webpack.optimize.UglifyJsPlugin({
4141
sourceMap: false,
4242
output: {

0 commit comments

Comments
 (0)