Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/webpack-plugin/lib/wxss/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ module.exports = async function loader (content, map, meta) {
return getRequestString('styles', { src: url }, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里走原始的stringifyRequest就可以了吧

isStatic: true,
issuerResource: this.resource,
fromImport: true
fromImport: true,
...(isRN ? { extract: false } : {})
})
}
})
Expand Down
4 changes: 1 addition & 3 deletions packages/webpack-plugin/lib/wxss/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1052,10 +1052,8 @@ function getModuleCode (
`@import url(${url});`
)}${printedParam.length > 0 ? `, ${printedParam}` : ''}]);\n`
} else {
// 符合css后缀名的文件经过mpx处理后会带上相应的后缀防止使用 WebPack 的默认解析规则,此时 require/import 相应路径时,导出的不是一段 css 代码了,事实上是一个文件路径。
const printedParam = printParams(media, dedupe, supports, layer)
const otherParams = printedParam.length > 0 ? printedParam : ''
beforeCode += `___CSS_LOADER_EXPORT___.push([module.id, '@import "' + ${item.importName} + '";', ${JSON.stringify(otherParams)} ]);\n`
beforeCode += `___CSS_LOADER_EXPORT___.i(${item.importName}${printedParam.length > 0 ? `, ${printedParam}` : ''});\n`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥要改这块?

}
}

Expand Down