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

Commit ec9dac1

Browse files
committed
chore(webpack): use include instead of exclude
1 parent 2ab48b3 commit ec9dac1

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

webpack/env.es6

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ export const statsName = 'stats'
3636
export const contextPath = path.join(__dirname, '..')
3737
export const distPath = path.join(contextPath, 'build')
3838
export const outputPath = path.join(distPath, 'public')
39+
export const srcPath = path.join(contextPath, 'src')

webpack/env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ const statsName = exports.statsName = 'stats'
3636
const contextPath = exports.contextPath = path.join(__dirname, '..')
3737
const distPath = exports.distPath = path.join(contextPath, 'dist')
3838
const outputPath = exports.outputPath = path.join(distPath, 'public')
39+
const srcPath = exports.srcPath = path.join(contextPath, 'src')

webpack/webpack.client.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
const { appName, cssName, inlineName, isDev, statsName, vendorName } = require('./env')
2+
const { appName, cssName, inlineName, isDev, statsName, vendorName, srcPath } = require('./env')
33
const { webpackConfig, styleLoader, cssLoader, postcssLoader } = require('./webpack.config')
44
const { StatsWriterPlugin } = require('webpack-stats-plugin')
55
const ExtractTextPlugin = require('extract-text-webpack-plugin')
@@ -32,7 +32,7 @@ const webpackClientConfig = merge({}, webpackConfig, {
3232
use: isDev
3333
? [styleLoader, cssLoader, postcssLoader]
3434
: extractCSS.extract([cssLoader, postcssLoader]),
35-
exclude: /node_modules/,
35+
include: srcPath,
3636
},
3737
]),
3838
},

webpack/webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
const { isDev, contextPath, outputPath } = require('./env')
2+
const { isDev, contextPath, outputPath, srcPath } = require('./env')
33
const webpack = require('webpack')
44

55
const GLOBALS = {
@@ -38,9 +38,9 @@ exports.cssLoader = {
3838
}
3939

4040
const webpackConfig = {
41+
bail: !isDev,
4142
cache: isDev,
4243
context: contextPath,
43-
bail: !isDev,
4444
devtool: isDev && 'cheap-eval-source-map',
4545
output: {
4646
publicPath: '/',
@@ -54,7 +54,7 @@ const webpackConfig = {
5454
options: {
5555
cacheDirectory: true,
5656
},
57-
exclude: /node_modules/,
57+
include: srcPath,
5858
},
5959
],
6060
},

webpack/webpack.server.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
const merge = require('lodash.merge')
3-
const { distPath } = require('./env')
3+
const { distPath, srcPath } = require('./env')
44
const { webpackConfig, cssLoader, postcssLoader } = require('./webpack.config')
55

66
const cssLoaderServer = Object.assign({}, cssLoader, { loader: 'css-loader/locals' })
@@ -21,7 +21,7 @@ const webpackServerConfig = merge({}, webpackConfig, {
2121
rules: webpackConfig.module.rules.concat([{
2222
test: /\.css$/,
2323
use: [cssLoaderServer, postcssLoader],
24-
exclude: /node_modules/,
24+
include: srcPath,
2525
}]),
2626
},
2727
node: {

0 commit comments

Comments
 (0)