File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ module.exports = class RequireSplitChunkWebpackPlugin {
8787
8888 /** 完成编译后的同步钩子 */
8989 afterCompilation ( compilation : Webpack . compilation . Compilation ) {
90- // 优化每个资源时触发
90+ // 优化资源时触发
9191 compilation . hooks . optimizeChunkAssets . tap ( this . name , ( chunks ) => {
9292 const assets : Assets = compilation . assets ;
9393 const entryFiles = this . getScriptFile ( chunks . filter ( ( chunk ) => chunk . hasEntryModule ( ) ) ) ;
@@ -112,9 +112,11 @@ module.exports = class RequireSplitChunkWebpackPlugin {
112112 if ( ! this . checkAllow ( compiler ) ) {
113113 return ;
114114 }
115-
115+
116+ const { output } = compiler . options ;
117+
116118 // 读取编译配置
117- this . publicPath = compiler . options . output ?. publicPath || '' ;
119+ this . publicPath = output ?. path || output ?. publicPath || '' ;
118120 // 完成编译时触发
119121 compiler . hooks . compilation . tap ( this . name , this . afterCompilation . bind ( this ) ) ;
120122 }
You can’t perform that action at this time.
0 commit comments