提交 656a8107 编写于 作者: L liaofeiyin 提交者: qiang

fix(webpack-uni-app-loader): require 相对路径错误

上级 31e2e9b3
...@@ -47,9 +47,11 @@ function addSubPackagesRequire (compilation) { ...@@ -47,9 +47,11 @@ function addSubPackagesRequire (compilation) {
name.indexOf(root + '/') === 0 && name.indexOf(root + '/') === 0 &&
name !== subPackageVendorPath name !== subPackageVendorPath
) { ) {
const source = let relativePath = normalizePath(path.relative(path.dirname(name), subPackageVendorPath))
`require('${normalizePath(path.relative(path.dirname(name), subPackageVendorPath))}');` + if (!relativePath.startsWith('.')) {
compilation.assets[name].source() relativePath = './' + relativePath
}
const source = `require('${relativePath}');` + compilation.assets[name].source()
compilation.assets[name] = { compilation.assets[name] = {
size () { size () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册