File tree 3 files changed +17
-10
lines changed
packages/@vue/cli-service
3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 1
1
// This file is imported into lib/wc client bundles.
2
2
3
3
if ( typeof window !== 'undefined' ) {
4
+ var currentScript = window . document . currentScript
4
5
if ( process . env . NEED_CURRENTSCRIPT_POLYFILL ) {
5
- require ( 'current-script-polyfill' )
6
+ var getCurrentScript = require ( '@soda/get-current-script' )
7
+ currentScript = getCurrentScript ( )
8
+
9
+ // for backward compatibility, because previously we directly included the polyfill
10
+ if ( ! ( 'currentScript' in document ) ) {
11
+ Object . defineProperty ( document , 'currentScript' , { get : getCurrentScript } )
12
+ }
6
13
}
7
14
8
- var i
9
- if ( ( i = window . document . currentScript ) && ( i = i . src . match ( / ( . + \/ ) [ ^ / ] + \. j s ( \? . * ) ? $ / ) ) ) {
10
- __webpack_public_path__ = i [ 1 ] // eslint-disable-line
15
+ var src = currentScript && currentScript . src . match ( / ( . + \/ ) [ ^ / ] + \. j s ( \? . * ) ? $ / )
16
+ if ( src ) {
17
+ __webpack_public_path__ = src [ 1 ] // eslint-disable-line
11
18
}
12
19
}
13
20
Original file line number Diff line number Diff line change 25
25
"dependencies" : {
26
26
"@intervolga/optimize-cssnano-plugin" : " ^1.0.5" ,
27
27
"@soda/friendly-errors-webpack-plugin" : " ^1.7.1" ,
28
+ "@soda/get-current-script" : " ^1.0.0" ,
28
29
"@vue/cli-overlay" : " ^4.2.3" ,
29
30
"@vue/cli-plugin-router" : " ^4.2.3" ,
30
31
"@vue/cli-plugin-vuex" : " ^4.2.3" ,
45
46
"copy-webpack-plugin" : " ^5.1.1" ,
46
47
"css-loader" : " ^3.4.2" ,
47
48
"cssnano" : " ^4.1.10" ,
48
- "current-script-polyfill" : " ^1.0.0" ,
49
49
"debug" : " ^4.1.1" ,
50
50
"default-gateway" : " ^5.0.5" ,
51
51
"dotenv" : " ^8.2.0" ,
Original file line number Diff line number Diff line change 2306
2306
error-stack-parser "^2.0.0"
2307
2307
string-width "^2.0.0"
2308
2308
2309
+ "@soda/get-current-script@^1.0.0":
2310
+ version "1.0.0"
2311
+ resolved "https://registry.yarnpkg.com/@soda/get-current-script/-/get-current-script-1.0.0.tgz#623aa40623550e3b94767cffeb096a6fb597ed09"
2312
+ integrity sha512-9GvTek+7cVw7r+L7TNGOG1astZJWXz2h5q4BqMXl28KN+24iSCm1xo+RhZOZvwdT3bzNe9hD7riJc/lBoO7mgg==
2313
+
2309
2314
"@szmarczak/http-timer@^1.1.2":
2310
2315
version "1.1.2"
2311
2316
resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421"
@@ -6317,11 +6322,6 @@ csv-parser@^1.6.0:
6317
6322
minimist "^1.2.0"
6318
6323
ndjson "^1.4.0"
6319
6324
6320
- current-script-polyfill@^1.0.0:
6321
- version "1.0.0"
6322
- resolved "https://registry.yarnpkg.com/current-script-polyfill/-/current-script-polyfill-1.0.0.tgz#f31cf7e4f3e218b0726e738ca92a02d3488ef615"
6323
- integrity sha1-8xz35PPiGLBybnOMqSoC00iO9hU=
6324
-
6325
6325
currently-unhandled@^0.4.1:
6326
6326
version "0.4.1"
6327
6327
resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"
You can’t perform that action at this time.
0 commit comments