提交 f6461c06 编写于 作者: Q qiang

fix: 移除部分含有错误引用的 wxss 文件

上级 7459c1f1
...@@ -64,6 +64,7 @@ module.exports = function generateComponent (compilation) { ...@@ -64,6 +64,7 @@ module.exports = function generateComponent (compilation) {
const concatenatedModules = modules.filter(module => module.modules) const concatenatedModules = modules.filter(module => module.modules)
const uniModuleId = modules.find(module => module.resource && normalizePath(module.resource) === uniPath).id const uniModuleId = modules.find(module => module.resource && normalizePath(module.resource) === uniPath).id
const wxssImports = {}
Object.keys(assets).forEach(name => { Object.keys(assets).forEach(name => {
if (components.has(name.replace('.js', ''))) { if (components.has(name.replace('.js', ''))) {
...@@ -125,6 +126,24 @@ module.exports = function generateComponent (compilation) { ...@@ -125,6 +126,24 @@ module.exports = function generateComponent (compilation) {
assets[name].source = newSource assets[name].source = newSource
} }
} }
if (name.endsWith('.wxss')) {
// 移除部分含有错误引用的 wxss 文件
const origSource = assets[name].source().trim()
const result = origSource.match(/^@import ["'](.+?)["']$/)
if (result) {
const wxssPath = path.join(path.dirname(name), result[1])
if (Object.keys(assets).includes(wxssPath)) {
wxssImports[wxssPath] = wxssImports[wxssPath] || []
wxssImports[wxssPath].push(name)
} else {
if (wxssImports[name]) {
wxssImports[name].forEach(name => delete assets[name])
delete wxssImports[name]
}
delete assets[name]
}
}
}
}) })
} }
if (process.env.UNI_FEATURE_OBSOLETE !== 'false') { if (process.env.UNI_FEATURE_OBSOLETE !== 'false') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册