diff --git a/packages/webpack-uni-mp-loader/lib/plugin/generate-component.js b/packages/webpack-uni-mp-loader/lib/plugin/generate-component.js index 31dea950527f0970676386ed0f70a139020e3237..1e017f99532df5b3e9b1c2bf47c0202eb0c6146c 100644 --- a/packages/webpack-uni-mp-loader/lib/plugin/generate-component.js +++ b/packages/webpack-uni-mp-loader/lib/plugin/generate-component.js @@ -133,7 +133,7 @@ module.exports = function generateComponent (compilation) { origSource = origSource.trim ? origSource.trim() : '' const result = origSource.match(/^@import ["'](.+?)["']$/) if (result) { - const stylePath = path.join(path.dirname(name), result[1]) + const stylePath = normalizePath(path.join(path.dirname(name), result[1])) if (Object.keys(assets).includes(stylePath)) { styleImports[stylePath] = styleImports[stylePath] || [] styleImports[stylePath].push(name) @@ -155,7 +155,7 @@ module.exports = function generateComponent (compilation) { if (json) { const data = JSON.parse(json) const usingComponents = data.usingComponents || {} - const componentPath = path.relative('/', usingComponents[parentName]) + const componentPath = normalizePath(path.relative('/', usingComponents[parentName])) const slots = fixSlots[componentPath] = fixSlots[componentPath] || {} const slot = slots[slotName] = slots[slotName] || {} slot[componentName] = '/' + name.replace(fixExtname, '')