Skip to content

Commit 17b8034

Browse files
committed
Fix LESS/SASS loader path
1 parent 5c40a04 commit 17b8034

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

programs/develop/webpack/plugin-css/css-tools/less.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ export function isUsingLess(projectPath: string): boolean {
3434

3535
type Loader = Record<string, any>
3636

37-
export async function maybeUseLess(
38-
projectPath: string,
39-
mode: DevOptions['mode']
40-
): Promise<Loader[]> {
37+
export async function maybeUseLess(projectPath: string): Promise<Loader[]> {
4138
if (!isUsingLess(projectPath)) return []
4239

4340
try {
@@ -58,7 +55,7 @@ export async function maybeUseLess(
5855
test: /\.less$/,
5956
use: [
6057
{
61-
loader: 'less-loader'
58+
loader: require.resolve('less-loader')
6259
}
6360
],
6461
type: 'css/auto'

programs/develop/webpack/plugin-css/css-tools/sass.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ export function isUsingSass(projectPath: string): boolean {
3434

3535
type Loader = Record<string, any>
3636

37-
export async function maybeUseSass(
38-
projectPath: string,
39-
mode: DevOptions['mode']
40-
): Promise<Loader[]> {
37+
export async function maybeUseSass(projectPath: string): Promise<Loader[]> {
4138
if (!isUsingSass(projectPath)) return []
4239

4340
try {
@@ -73,7 +70,7 @@ export async function maybeUseSass(
7370
test: /\.(sass|scss)$/,
7471
use: [
7572
{
76-
loader: 'sass-loader',
73+
loader: require.resolve('sass-loader'),
7774
options: {
7875
// using `modern-compiler` and `sass-embedded` together
7976
// significantly improve build performance,

programs/develop/webpack/plugin-css/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,8 @@ export class CssPlugin {
4545
Boolean
4646
)
4747

48-
const maybeInstallSass = await maybeUseSass(
49-
projectPath,
50-
mode as 'development' | 'production'
51-
)
52-
const maybeInstallLess = await maybeUseLess(
53-
projectPath,
54-
mode as 'development' | 'production'
55-
)
48+
const maybeInstallSass = await maybeUseSass(projectPath)
49+
const maybeInstallLess = await maybeUseLess(projectPath)
5650
loaders.push(...maybeInstallSass)
5751
loaders.push(...maybeInstallLess)
5852

programs/develop/webpack/webpack-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export default function webpackConfig(
157157
maxEntrypointSize: 999000
158158
},
159159
optimization: {
160-
minimize: devOptions.mode === 'production',
160+
minimize: devOptions.mode === 'production'
161161
},
162162
experiments: {
163163
// Enable native CSS support by default

0 commit comments

Comments
 (0)