Skip to content

Commit

Permalink
fix: sass-loader @import 不带scss后缀的文件时编译报错问题 (#9220)
Browse files Browse the repository at this point in the history
  • Loading branch information
shjyh authored Apr 29, 2021
1 parent 51ca357 commit 5166b8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/taro-mini-runner/src/webpack/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ export const getModule = (appPath: string, {
importer (url, prev, done) {
// 让 sass 文件里的 @import 能解析小程序原生样式文体,如 @import "a.wxss";
const extname = path.extname(url)
if (extname === '.scss' || extname === '.sass' || extname === '.css') {
// fix: @import 文件可以不带scss/sass缀,如: @import "define";
if (extname === '.scss' || extname === '.sass' || extname === '.css' || !extname) {
return null
} else {
const filePath = path.resolve(path.dirname(prev), url)
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-webpack-runner/src/util/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ export const getModule = (appPath: string, {
importer (url, prev, done) {
// 让 sass 文件里的 @import 能解析小程序原生样式文体,如 @import "a.wxss";
const extname = path.extname(url)
if (extname === '.scss' || extname === '.sass' || extname === '.css') {
// fix: @import 文件可以不带scss/sass缀,如: @import "define";
if (extname === '.scss' || extname === '.sass' || extname === '.css' || !extname) {
return null
} else {
const filePath = path.resolve(path.dirname(prev), url)
Expand Down

0 comments on commit 5166b8f

Please sign in to comment.