Open
Description
webpack配置
publichPath
: '//7.url.cn/edu/user/'
插件配置
filename: (n) => `${n}/${n}`
Resource.js
// add a file to newNodes
const outToNewNodes = (fileName, fileContent) => {
// resource should load in URL relative to html output path
let resourceRelative2HTMLPath = url.resolve(webpackOutputPublicPath, fileName);
resourceRelative2HTMLPath = util.urlRelative(htmlOutputURL, resourceRelative2HTMLPath);
resourceRelative2HTMLPath = url.resolve(webpackOutputPublicPath, resourceRelative2HTMLPath);
if (type === 'script') {
// output js file only
...
} else if (type === 'style') {
// output css file only
...
} else if (type === 'other') {
...
}
};
此类情况当执行到上面Resource.js文件的outToNewNodes方法时,resourceRelative2HTMLPath最终计算出资源文件的路径为//7.url.cn/edu/[name]
,故html加载资源的路径出错。
注释掉这两行代码后,跑通
// resourceRelative2HTMLPath = util.urlRelative(htmlOutputURL, resourceRelative2HTMLPath);
// resourceRelative2HTMLPath = url.resolve(webpackOutputPublicPath, resourceRelative2HTMLPath);
Metadata
Metadata
Assignees
Labels
No labels