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

perf: enable SWC disableAllLints by default to reduce overhead #8275

Merged
merged 4 commits into from
Oct 31, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ ERROR in × failed to parse builtin:swc-loader options
· ▲
· ╰── unknown field `parser2`, expected one of `assumptions`, `parser`, `transform`, `externalHelpers`, `target`, `loose`, `keepClassNames`, `baseUrl`, `paths`, `minify`, `experimental`, `lints`, `preserveAllComments`, `output` at line 3 column 13
4 │ "syntax": "ecmascript"
5 │ }
5 │ },
╰────
22 changes: 16 additions & 6 deletions packages/rspack/src/config/adapterRuleUse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,24 @@ type GetLoaderOptions = (
options: ComposeJsUseOptions
) => RuleSetLoaderWithOptions["options"];

const getSwcLoaderOptions: GetLoaderOptions = (o, _) => {
if (o && typeof o === "object" && o.rspackExperiments) {
const expr = o.rspackExperiments;
if (expr.import || expr.pluginImport) {
expr.import = resolvePluginImport(expr.import || expr.pluginImport);
const getSwcLoaderOptions: GetLoaderOptions = (options, _) => {
if (options && typeof options === "object") {
// enable `disableAllLints` by default to reduce performance overhead
options.jsc ??= {};
options.jsc.experimental ??= {};
options.jsc.experimental.disableAllLints ??= true;

// resolve `rspackExperiments.import` options
const { rspackExperiments } = options;
if (rspackExperiments) {
if (rspackExperiments.import || rspackExperiments.pluginImport) {
rspackExperiments.import = resolvePluginImport(
rspackExperiments.import || rspackExperiments.pluginImport
);
}
}
}
return o;
return options;
};

const getLightningcssLoaderOptions: GetLoaderOptions = (o, _) => {
Expand Down
Loading