-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support enable lightningcssLoader (#6614)
- Loading branch information
Showing
15 changed files
with
285 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@modern-js/uni-builder': patch | ||
--- | ||
|
||
feat: support enable lightningcssLoader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
packages/cli/uni-builder/tests/__snapshots__/postcssLegacy.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/document/main-doc/docs/en/configure/app/tools/lightningcss-loader.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: lightningcssLoader | ||
configName: tools.lightningcssLoader | ||
--- | ||
|
||
# tools.lightningcssLoader | ||
|
||
- **Type:** `Rspack.LightningcssLoaderOptions | Function | boolean` | ||
- **Default:** `Rspack.LightningcssLoaderOptions | Function | boolean` | ||
- **Bundler:** `only support rspack` | ||
|
||
You can configure [builtin:lightningcss-loader](https://rspack.dev/guide/features/builtin-lightningcss-loader) through `tools.lightningcssLoader`. | ||
|
||
## Enable loader | ||
|
||
Set `tools.lightningcssLoader` to `true` to enable Rsbuild's built-in `lightningcss-loader`: | ||
|
||
```js | ||
export default { | ||
tools: { | ||
lightningcssLoader: true, | ||
}, | ||
}; | ||
``` | ||
|
||
At this time, the default configuration is as follows: | ||
|
||
```js | ||
const defaultOptions = { | ||
// use current browserslist config | ||
targets: browserslist, | ||
// minify is enabled when output.injectStyles is true and in production mode | ||
minify: config.mode === 'production' && config.output.injectStyles, | ||
}; | ||
``` | ||
|
||
It should be noted that when `lightningcss-loader` is turned on, `postcss-loader` will be turned off by default. | ||
|
||
import RsbuildConig from '@site-docs/components/rsbuild-config-tooltip'; | ||
|
||
<RsbuildConig /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.