Skip to content

Commit e37dcf6

Browse files
committed
fix(server): 修复ext插件找不到编译路径问题
1 parent 531d3fb commit e37dcf6

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/plugins/extTemplatedPathPlugin.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ module.exports = {
2626
});
2727

2828
// 替换[name]为文件名,如index.js:[name][ext] => index[ext]
29-
baseName = sysPath.basename(rawRequest, extName);
30-
baseName = baseName.split('.')[0];
31-
if (baseName) {
32-
path = path.replace(/\[name\]/g, baseName);
29+
if (_module.chunks[0] && _module.chunks[0].name) {
30+
path = path.replace(/\[name\]/g, _module.chunks[0].name.replace(/\.\w+$/g, ''));
3331
}
3432
}
3533

src/plugins/extTemplatedPathPlugin.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ module.exports = {
2828
})
2929

3030
// 替换[name]为文件名,如index.js:[name][ext] => index[ext]
31-
baseName = sysPath.basename(rawRequest, extName);
32-
baseName = baseName.split('.')[0]
33-
if(baseName) {
34-
path = path.replace(/\[name\]/g, baseName);
31+
if(module.chunks[0] && module.chunks[0].name) {
32+
path = path.replace(/\[name\]/g, module.chunks[0].name.replace(/\.\w+$/g, ''));
3533
}
3634
}
3735

0 commit comments

Comments
 (0)