Skip to content

Commit

Permalink
chore: 调整插件配置和项目配置文件的优先级
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongzhi107 committed Dec 5, 2019
1 parent 7923b8e commit dace313
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/webpack/config/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import util from 'util';
import WebpackBar from 'webpackbar';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import StartServerPlugin from 'start-server-webpack-plugin';
import errorOverlayMiddleware from 'react-dev-utils/errorOverlayMiddleware';
import eslintFormatter from 'react-dev-utils/eslintFormatter';
import nodeExternals from 'webpack-node-externals';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
Expand Down Expand Up @@ -474,7 +473,7 @@ export default ({
'Access-Control-Allow-Origin': `http://${DACE_HOST}:${DACE_PORT}`,
'Access-Control-Allow-Credentials': true
},
host: DACE_HOST,
host: '0.0.0.0',
hot: true,
noInfo: !program.verbose,
overlay: false,
Expand All @@ -485,10 +484,6 @@ export default ({
// https://github.com/facebookincubator/create-react-app/issues/293
watchOptions: {
ignored: /node_modules/
},
before(app) {
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
}
};
// Add client-only development plugins
Expand Down Expand Up @@ -541,10 +536,6 @@ export default ({
];
}

if (modify) {
config = modify(config, { target, isDev: IS_DEV }, webpack);
}

// 绑定 dace 插件
if (plugins) {
if (!Array.isArray(plugins)) {
Expand Down Expand Up @@ -577,5 +568,10 @@ export default ({
});
}

// 项目中的配置文件优先级最高
if (modify) {
config = modify(config, { target, isDev: IS_DEV }, webpack);
}

return config;
};

0 comments on commit dace313

Please sign in to comment.