mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-22 02:57:45 +02:00
feat(core): faster transpiler option - siteConfig.future.experimental_faster.swcJsLoader
(#10435)
This commit is contained in:
parent
349a58453a
commit
418247ec87
30 changed files with 1298 additions and 847 deletions
35
packages/docusaurus-faster/src/index.ts
Normal file
35
packages/docusaurus-faster/src/index.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {RuleSetRule} from 'webpack';
|
||||
|
||||
export function getSwcJsLoaderFactory({
|
||||
isServer,
|
||||
}: {
|
||||
isServer: boolean;
|
||||
}): RuleSetRule {
|
||||
return {
|
||||
loader: require.resolve('swc-loader'),
|
||||
options: {
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
tsx: true,
|
||||
},
|
||||
transform: {
|
||||
react: {
|
||||
runtime: 'automatic',
|
||||
},
|
||||
},
|
||||
target: 'es2017',
|
||||
},
|
||||
module: {
|
||||
type: isServer ? 'commonjs' : 'es6',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue