mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-22 02:57:45 +02:00
feat(core): Replace Webpack with Rspack - siteConfig.future.experimental_faster.rspackBundler
(#10402)
This commit is contained in:
parent
c7fd8d1702
commit
74c09aee35
17 changed files with 390 additions and 174 deletions
|
@ -5,12 +5,15 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import Rspack from '@rspack/core';
|
||||
import * as lightningcss from 'lightningcss';
|
||||
import browserslist from 'browserslist';
|
||||
import {minify as swcHtmlMinifier} from '@swc/html';
|
||||
import type {RuleSetRule} from 'webpack';
|
||||
import type {JsMinifyOptions} from '@swc/core';
|
||||
|
||||
export const rspack = Rspack;
|
||||
|
||||
export function getSwcHtmlMinifier(): typeof swcHtmlMinifier {
|
||||
return swcHtmlMinifier;
|
||||
}
|
||||
|
@ -63,6 +66,15 @@ export function getSwcJsMinimizerOptions(): JsMinifyOptions {
|
|||
};
|
||||
}
|
||||
|
||||
// We need this because of Rspack built-in LightningCSS integration
|
||||
// See https://github.com/orgs/browserslist/discussions/846
|
||||
export function getBrowserslistQueries(): string[] {
|
||||
const queries = browserslist.loadConfig({path: process.cwd()}) ?? [
|
||||
...browserslist.defaults,
|
||||
];
|
||||
return queries;
|
||||
}
|
||||
|
||||
// LightningCSS doesn't expose any type for css-minimizer-webpack-plugin setup
|
||||
// So we derive it ourselves
|
||||
// see https://lightningcss.dev/docs.html#with-webpack
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue