Skip to content

Commit ef30dcd

Browse files
author
linfeng
committed
feat: add webpack circular-dependency-plugin
1 parent b501a31 commit ef30dcd

4 files changed

Lines changed: 40 additions & 100 deletions

File tree

declare/npm.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ declare module 'gulp-clean-css';
6767
declare module 'gulp-if';
6868
declare module 'gulp-concat-css';
6969
declare module 'gulp-strip-css-comments';
70+
declare module 'circular-dependency-plugin';

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
"webpack-sources": "1.3.0",
144144
"webpackbar": "3.2.0",
145145
"worker-loader": "2.0.0",
146-
"yargs": "13.2.4"
146+
"yargs": "13.2.4",
147+
"circular-dependency-plugin": "4.4.0"
147148
}
148-
}
149+
}

src/utils/webpack-dev-server.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as path from 'path';
66
import * as urlJoin from 'url-join';
77
import * as webpack from 'webpack';
88
import * as WebpackBar from 'webpackbar';
9+
import * as CircularDependencyPlugin from 'circular-dependency-plugin';
910
import * as _ from 'lodash';
1011
import * as WebpackDevServer from 'webpack-dev-server';
1112
import { globalState } from './global-state';
@@ -25,7 +26,7 @@ interface IExtraOptions {
2526
}
2627

2728
const stats = {
28-
warnings: false,
29+
warnings: true,
2930
version: false,
3031
modules: false,
3132
entrypoints: false,
@@ -45,6 +46,13 @@ export const runWebpackDevServer = async (opts: IOptions<IExtraOptions>) => {
4546

4647
webpackConfig.plugins.push(new WebpackBar());
4748

49+
webpackConfig.plugins.push(
50+
new CircularDependencyPlugin({
51+
exclude: /node_modules/,
52+
cwd: process.cwd(),
53+
}),
54+
);
55+
4856
const webpackDevServerConfig: WebpackDevServer.Configuration = {
4957
host: '127.0.0.1',
5058
hot: opts.hot,
@@ -66,7 +74,7 @@ export const runWebpackDevServer = async (opts: IOptions<IExtraOptions>) => {
6674
}),
6775
},
6876
headers: { 'Access-Control-Allow-Origin': '*' },
69-
clientLogLevel: 'warning',
77+
clientLogLevel: 'warn',
7078
disableHostCheck: true,
7179
port: opts.devServerPort,
7280
} as any;

yarn.lock

Lines changed: 26 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,11 +1497,6 @@
14971497
resolved "https://registry.npm.alibaba-inc.com/@types/node/download/@types/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c"
14981498
integrity sha1-5Gm0v50cmDKu5JB7qKBRSUNXwSw=
14991499

1500-
"@types/normalize-package-data@^2.4.0":
1501-
version "2.4.0"
1502-
resolved "https://registry.npm.alibaba-inc.com/@types/normalize-package-data/download/@types/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
1503-
integrity sha1-5IbQ2XOW15vu3QpuM/RTT/a0lz4=
1504-
15051500
"@types/prop-types@*":
15061501
version "15.7.1"
15071502
resolved "https://registry.npm.alibaba-inc.com/@types/prop-types/download/@types/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6"
@@ -3156,6 +3151,11 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
31563151
inherits "^2.0.1"
31573152
safe-buffer "^5.0.1"
31583153

3154+
circular-dependency-plugin@4.4.0:
3155+
version "4.4.0"
3156+
resolved "https://registry.npm.taobao.org/circular-dependency-plugin/download/circular-dependency-plugin-4.4.0.tgz#f8a1a746a3f6c8e57f4dae9b54d991cd2a582f5d"
3157+
integrity sha1-+KGnRqP2yOV/Ta6bVNmRzSpYL10=
3158+
31593159
class-utils@^0.3.5:
31603160
version "0.3.6"
31613161
resolved "https://registry.npm.alibaba-inc.com/class-utils/download/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463"
@@ -3656,9 +3656,9 @@ cors@2.8.5:
36563656
object-assign "^4"
36573657
vary "^1"
36583658

3659-
cosmiconfig@^5.0.0, cosmiconfig@^5.2.1:
3659+
cosmiconfig@^5.0.0, cosmiconfig@^5.0.7:
36603660
version "5.2.1"
3661-
resolved "https://registry.npm.alibaba-inc.com/cosmiconfig/download/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a"
3661+
resolved "https://registry.npm.taobao.org/cosmiconfig/download/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a"
36623662
integrity sha1-BA9yaAnFked6F8CjYmykW08Wixo=
36633663
dependencies:
36643664
import-fresh "^2.0.0"
@@ -5263,14 +5263,6 @@ find-up@^3.0.0:
52635263
dependencies:
52645264
locate-path "^3.0.0"
52655265

5266-
find-up@^4.0.0:
5267-
version "4.1.0"
5268-
resolved "https://registry.npm.alibaba-inc.com/find-up/download/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
5269-
integrity sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk=
5270-
dependencies:
5271-
locate-path "^5.0.0"
5272-
path-exists "^4.0.0"
5273-
52745266
findup-sync@^2.0.0:
52755267
version "2.0.0"
52765268
resolved "https://registry.npm.alibaba-inc.com/findup-sync/download/findup-sync-2.0.0.tgz#9326b1488c22d1a6088650a86901b2d9a90a2cbc"
@@ -5551,11 +5543,6 @@ get-stdin@^6.0.0:
55515543
resolved "https://registry.npm.alibaba-inc.com/get-stdin/download/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
55525544
integrity sha1-ngm/cSs2CrkiXoEgSPcf3pyJZXs=
55535545

5554-
get-stdin@^7.0.0:
5555-
version "7.0.0"
5556-
resolved "https://registry.npm.alibaba-inc.com/get-stdin/download/get-stdin-7.0.0.tgz#8d5de98f15171a125c5e516643c7a6d0ea8a96f6"
5557-
integrity sha1-jV3pjxUXGhJcXlFmQ8em0OqKlvY=
5558-
55595546
get-stream@^3.0.0:
55605547
version "3.0.0"
55615548
resolved "https://registry.npm.alibaba-inc.com/get-stream/download/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
@@ -6373,21 +6360,21 @@ https-proxy-agent@^2.2.1:
63736360
agent-base "^4.3.0"
63746361
debug "^3.1.0"
63756362

6376-
husky@3.0.0:
6377-
version "3.0.0"
6378-
resolved "https://registry.npm.alibaba-inc.com/husky/download/husky-3.0.0.tgz#de63821a7049dc412b1afd753c259e2f6e227562"
6379-
integrity sha1-3mOCGnBJ3EErGv11PCWeL24idWI=
6363+
husky@1.3.1:
6364+
version "1.3.1"
6365+
resolved "https://registry.npm.taobao.org/husky/download/husky-1.3.1.tgz#26823e399300388ca2afff11cfa8a86b0033fae0"
6366+
integrity sha1-JoI+OZMAOIyir/8Rz6ioawAz+uA=
63806367
dependencies:
6381-
cosmiconfig "^5.2.1"
6368+
cosmiconfig "^5.0.7"
63826369
execa "^1.0.0"
6383-
get-stdin "^7.0.0"
6370+
find-up "^3.0.0"
6371+
get-stdin "^6.0.0"
63846372
is-ci "^2.0.0"
6385-
opencollective-postinstall "^2.0.2"
6386-
pkg-dir "^4.2.0"
6373+
pkg-dir "^3.0.0"
63876374
please-upgrade-node "^3.1.1"
6388-
read-pkg "^5.1.1"
6375+
read-pkg "^4.0.1"
63896376
run-node "^1.0.0"
6390-
slash "^3.0.0"
6377+
slash "^2.0.0"
63916378

63926379
hyphenate-style-name@^1.0.3:
63936380
version "1.0.3"
@@ -8019,11 +8006,6 @@ liftoff@^3.1.0:
80198006
rechoir "^0.6.2"
80208007
resolve "^1.1.7"
80218008

8022-
lines-and-columns@^1.1.6:
8023-
version "1.1.6"
8024-
resolved "https://registry.npm.alibaba-inc.com/lines-and-columns/download/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
8025-
integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=
8026-
80278009
load-json-file@^1.0.0:
80288010
version "1.1.0"
80298011
resolved "https://registry.npm.alibaba-inc.com/load-json-file/download/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0"
@@ -8095,13 +8077,6 @@ locate-path@^3.0.0:
80958077
p-locate "^3.0.0"
80968078
path-exists "^3.0.0"
80978079

8098-
locate-path@^5.0.0:
8099-
version "5.0.0"
8100-
resolved "https://registry.npm.alibaba-inc.com/locate-path/download/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
8101-
integrity sha1-Gvujlq/WdqbUJQTQpno6frn2KqA=
8102-
dependencies:
8103-
p-locate "^4.1.0"
8104-
81058080
lodash._arrayeach@^3.0.0:
81068081
version "3.0.0"
81078082
resolved "https://registry.npm.alibaba-inc.com/lodash._arrayeach/download/lodash._arrayeach-3.0.0.tgz#bab156b2a90d3f1bbd5c653403349e5e5933ef9e"
@@ -9055,7 +9030,7 @@ nopt@^4.0.1:
90559030
abbrev "1"
90569031
osenv "^0.1.4"
90579032

9058-
normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.5.0:
9033+
normalize-package-data@^2.3.2, normalize-package-data@^2.3.4:
90599034
version "2.5.0"
90609035
resolved "https://registry.npm.alibaba-inc.com/normalize-package-data/download/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8"
90619036
integrity sha1-5m2xg4sgDB38IzIl0SyzZSDiNKg=
@@ -9329,11 +9304,6 @@ open@6.4.0:
93299304
dependencies:
93309305
is-wsl "^1.1.0"
93319306

9332-
opencollective-postinstall@^2.0.2:
9333-
version "2.0.2"
9334-
resolved "https://registry.npm.alibaba-inc.com/opencollective-postinstall/download/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89"
9335-
integrity sha1-Vlfxvt5ptuM6RZObBh61PTxsOok=
9336-
93379307
opener@^1.5.1:
93389308
version "1.5.1"
93399309
resolved "https://registry.npm.alibaba-inc.com/opener/download/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed"
@@ -9473,7 +9443,7 @@ p-limit@^1.1.0:
94739443
dependencies:
94749444
p-try "^1.0.0"
94759445

9476-
p-limit@^2.0.0, p-limit@^2.2.0:
9446+
p-limit@^2.0.0:
94779447
version "2.2.0"
94789448
resolved "https://registry.npm.alibaba-inc.com/p-limit/download/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2"
94799449
integrity sha1-QXyZQeYCepq8ulCS3SkE4lW1+8I=
@@ -9494,13 +9464,6 @@ p-locate@^3.0.0:
94949464
dependencies:
94959465
p-limit "^2.0.0"
94969466

9497-
p-locate@^4.1.0:
9498-
version "4.1.0"
9499-
resolved "https://registry.npm.alibaba-inc.com/p-locate/download/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
9500-
integrity sha1-o0KLtwiLOmApL2aRkni3wpetTwc=
9501-
dependencies:
9502-
p-limit "^2.2.0"
9503-
95049467
p-map@^2.0.0:
95059468
version "2.1.0"
95069469
resolved "https://registry.npm.alibaba-inc.com/p-map/download/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175"
@@ -9631,16 +9594,6 @@ parse-json@^4.0.0:
96319594
error-ex "^1.3.1"
96329595
json-parse-better-errors "^1.0.1"
96339596

9634-
parse-json@^5.0.0:
9635-
version "5.0.0"
9636-
resolved "https://registry.npm.alibaba-inc.com/parse-json/download/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f"
9637-
integrity sha1-c+URTJhtFD76NxLU6iTbmkJm9g8=
9638-
dependencies:
9639-
"@babel/code-frame" "^7.0.0"
9640-
error-ex "^1.3.1"
9641-
json-parse-better-errors "^1.0.1"
9642-
lines-and-columns "^1.1.6"
9643-
96449597
parse-node-version@^1.0.0:
96459598
version "1.0.1"
96469599
resolved "https://registry.npm.alibaba-inc.com/parse-node-version/download/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b"
@@ -9707,11 +9660,6 @@ path-exists@^3.0.0:
97079660
resolved "https://registry.npm.alibaba-inc.com/path-exists/download/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
97089661
integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=
97099662

9710-
path-exists@^4.0.0:
9711-
version "4.0.0"
9712-
resolved "https://registry.npm.alibaba-inc.com/path-exists/download/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
9713-
integrity sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=
9714-
97159663
path-is-absolute@1.0.1, path-is-absolute@^1.0.0, path-is-absolute@^1.0.1:
97169664
version "1.0.1"
97179665
resolved "https://registry.npm.alibaba-inc.com/path-is-absolute/download/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
@@ -9856,13 +9804,6 @@ pkg-dir@^3.0.0:
98569804
dependencies:
98579805
find-up "^3.0.0"
98589806

9859-
pkg-dir@^4.2.0:
9860-
version "4.2.0"
9861-
resolved "https://registry.npm.alibaba-inc.com/pkg-dir/download/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
9862-
integrity sha1-8JkTPfft5CLoHR2ESCcO6z5CYfM=
9863-
dependencies:
9864-
find-up "^4.0.0"
9865-
98669807
please-upgrade-node@^3.1.1:
98679808
version "3.1.1"
98689809
resolved "https://registry.npm.alibaba-inc.com/please-upgrade-node/download/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac"
@@ -10791,15 +10732,14 @@ read-pkg@^3.0.0:
1079110732
normalize-package-data "^2.3.2"
1079210733
path-type "^3.0.0"
1079310734

10794-
read-pkg@^5.1.1:
10795-
version "5.2.0"
10796-
resolved "https://registry.npm.alibaba-inc.com/read-pkg/download/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc"
10797-
integrity sha1-e/KVQ4yloz5WzTDgU7NO5yUMk8w=
10735+
read-pkg@^4.0.1:
10736+
version "4.0.1"
10737+
resolved "https://registry.npm.taobao.org/read-pkg/download/read-pkg-4.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fread-pkg%2Fdownload%2Fread-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237"
10738+
integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc=
1079810739
dependencies:
10799-
"@types/normalize-package-data" "^2.4.0"
10800-
normalize-package-data "^2.5.0"
10801-
parse-json "^5.0.0"
10802-
type-fest "^0.6.0"
10740+
normalize-package-data "^2.3.2"
10741+
parse-json "^4.0.0"
10742+
pify "^3.0.0"
1080310743

1080410744
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6:
1080510745
version "2.3.6"
@@ -11662,11 +11602,6 @@ slash@^2.0.0:
1166211602
resolved "https://registry.npm.alibaba-inc.com/slash/download/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44"
1166311603
integrity sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=
1166411604

11665-
slash@^3.0.0:
11666-
version "3.0.0"
11667-
resolved "https://registry.npm.alibaba-inc.com/slash/download/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
11668-
integrity sha1-ZTm+hwwWWtvVJAIg2+Nh8bxNRjQ=
11669-
1167011605
slice-ansi@^2.1.0:
1167111606
version "2.1.0"
1167211607
resolved "https://registry.npm.alibaba-inc.com/slice-ansi/download/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636"
@@ -12662,11 +12597,6 @@ type-fest@^0.5.2:
1266212597
resolved "https://registry.npm.alibaba-inc.com/type-fest/download/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2"
1266312598
integrity sha1-1u9CoDVsbNRfSUhcO2KB/BSOSKI=
1266412599

12665-
type-fest@^0.6.0:
12666-
version "0.6.0"
12667-
resolved "https://registry.npm.alibaba-inc.com/type-fest/download/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b"
12668-
integrity sha1-jSojcNPfiG61yQraHFv2GIrPg4s=
12669-
1267012600
type-is@^1.6.16, type-is@~1.6.17, type-is@~1.6.18:
1267112601
version "1.6.18"
1267212602
resolved "https://registry.npm.alibaba-inc.com/type-is/download/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"

0 commit comments

Comments
 (0)