Skip to content

Commit

Permalink
Merge branch '1.0.8-wmj' into '1.0.8'
Browse files Browse the repository at this point in the history
1.0.8 wmj

See merge request cml/new-open-chameleon-sets!194
  • Loading branch information
wangmengjun committed Nov 13, 2020
2 parents 8048f25 + 68cf832 commit a72a1a7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
30 changes: 30 additions & 0 deletions packages/chameleon-tool/configs/getCommonConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const fs = require('fs');
const cmlUtils = require('chameleon-tool-utils');
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');

module.exports = function (options) {
let {
Expand Down Expand Up @@ -176,6 +177,9 @@ module.exports = function (options) {
if (chameleonConfig.optimize && chameleonConfig.optimize.processBar) {
commonConfig.plugins.push(new ProgressBarPlugin())
}
if (chameleonConfig.optimize && chameleonConfig.optimize.circularDependency) {
commonConfig.plugins.push(new ProgressBarPlugin())
}
if (options.definePlugin) {
commonConfig.plugins.push(new webpack.DefinePlugin(options.definePlugin))
}
Expand Down Expand Up @@ -214,6 +218,32 @@ module.exports = function (options) {
verbose: true
})
);

commonConfig.plugins.push(
new DuplicatePackageCheckerPlugin({
verbose: true
})
);
if (chameleonConfig.optimize && chameleonConfig.optimize.circularDependency) {
commonConfig.plugins.push(
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
exclude: /node_modules/,
// include specific files based on a RegExp
include: /src/,
// add errors to webpack instead of warnings
failOnError: true,
// allow import cycles that include an asyncronous import,
// e.g. via import(/* webpackMode: "weak" */ './file.js')
allowAsyncCycles: false,
// set the current working directory for displaying module paths
cwd: process.cwd()
})
);


}

}
// 兼容旧版api
commonConfig.plugins.push(new webpack.DefinePlugin({
Expand Down
3 changes: 2 additions & 1 deletion packages/chameleon-tool/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ var chameleonConfig = {
watchNodeModules: false, // 默认不对node_modules中的文件进行watch,提升编译性能
showWarning: false, // 为了兼容原来的配置,默认不开启构建过程中的警告信息,开启之后配合,DuplicatePackageCheckerPlugin 可以在构建过程中检查是否有重复npm包引入
dropConsole: true,
processBar: true
processBar: true,
circularDependency: true// 默认引入自动检测循环引用的插件
}
}

Expand Down
5 changes: 5 additions & 0 deletions packages/chameleon-tool/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/chameleon-tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"chameleon-vue-precompiler": "^1.0.8-alpah.1",
"chameleon-webpack-plugin": "^1.0.8-alpah.1",
"chameleon-weex-vue-loader": "^1.0.8-alpah.1",
"circular-dependency-plugin": "^4.4.0",
"clean-webpack-plugin": "0.1.19",
"cml-extract-css-webpack-plugin": "^1.0.8-alpah.1",
"cml-vue-loader": "^1.0.8-alpah.1",
Expand Down

0 comments on commit a72a1a7

Please sign in to comment.