Skip to content

Commit

Permalink
perf(bundler-webpack): use modern compiler for sass
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Jul 13, 2024
1 parent e3ed143 commit 7b52027
Show file tree
Hide file tree
Showing 4 changed files with 235 additions and 7 deletions.
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@vuepress-e2e/style-exports": "file:./modules/style-exports",
"@vuepress/bundler-vite": "workspace:*",
"@vuepress/bundler-webpack": "workspace:*",
"sass": "^1.77.6",
"sass-embedded": "^1.77.6",
"sass-loader": "^14.2.1",
"vue": "^3.4.29",
"vuepress": "workspace:*"
Expand Down
10 changes: 8 additions & 2 deletions packages/bundler-webpack/src/config/handleModuleStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,20 @@ export const handleModuleStyles = ({
lang: 'scss',
test: /\.scss$/,
loaderName: 'sass-loader',
loaderOptions: options.scss,
loaderOptions: {
api: 'modern-compiler',
...options.scss,
},
})

handleStyle<SassLoaderOptions>({
lang: 'sass',
test: /\.sass$/,
loaderName: 'sass-loader',
loaderOptions: options.sass,
loaderOptions: {
api: 'modern-compiler',
...options.sass,
},
})

handleStyle<LessLoaderOptions>({
Expand Down
1 change: 1 addition & 0 deletions packages/bundler-webpack/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export interface StylusLoaderOptions extends LoaderOptions {
* @see https://github.com/webpack-contrib/sass-loader#options
*/
export interface SassLoaderOptions extends LoaderOptions {
api?: 'legacy' | 'modern' | 'modern-compiler'
implementation?: Record<string, any> | string
sassOptions?: StylePreprocessorOptions
}
Expand Down
229 changes: 225 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7b52027

Please sign in to comment.