File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1717 "clean" : " rimraf dist" ,
1818 "prebuild" : " yarn clean" ,
1919 "build" : " cross-env NODE_ENV=production babel src -d dist --copy-files" ,
20- "test:only" : " cross-env NODE_ENV=test jest" ,
20+ "test:only" : " cross-env NODE_ENV=test NODE_OPTIONS= \" --openssl-legacy-provider \" jest" ,
2121 "test:watch" : " yarn test:only --watch" ,
2222 "test:coverage" : " yarn test:only --collectCoverageFrom=\" src/**/*.js\" --coverage" ,
2323 "pretest" : " yarn lint" ,
Original file line number Diff line number Diff line change @@ -210,8 +210,18 @@ class EncodingPlugin {
210210 ) ;
211211
212212 if ( this . options . patchWebpackBootstrap ) {
213- [ 'jsonpScript' , 'linkPreload' ] . forEach ( ( id ) => {
214- const hook = compilation . mainTemplate . hooks [ id ] ;
213+ const isRspack = compiler . rspack ;
214+
215+ const hookNames = isRspack
216+ ? [ 'createScript' , 'linkPreload' ]
217+ : [ 'jsonpScript' , 'linkPreload' ] ;
218+
219+ const hooks = isRspack
220+ ? compiler . webpack . RuntimePlugin . getCompilationHooks ( compilation )
221+ : compilation . mainTemplate . hooks ;
222+
223+ hookNames . forEach ( ( id ) => {
224+ const hook = hooks [ id ] ;
215225 if ( hook ) {
216226 hook . tap ( pluginName , ( s ) =>
217227 s . replace ( / ( [ " ' ] ) u t f - 8 [ " ' ] / gi, `$1${ this . options . encoding } $1` ) ,
You can’t perform that action at this time.
0 commit comments