Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sass-loader @import 不带scss后缀的文件时编译报错问题 #9220

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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/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