Skip to content

Commit

Permalink
add transform to config
Browse files Browse the repository at this point in the history
  • Loading branch information
kalsky committed Aug 19, 2024
1 parent 32a5dab commit 024ead8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
33 changes: 19 additions & 14 deletions docusaurus-prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,28 @@ const config = {
},
}),

webpack: {
jsLoader: (isServer) => ({
loader: require.resolve('swc-loader'),
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
target: 'es2017',
webpack: {
jsLoader: (isServer) => ({
loader: require.resolve('swc-loader'),
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
module: {
type: isServer ? 'commonjs' : 'es6',
transform: {
react: {
runtime: 'automatic',
},
},
target: 'es2017',
},
}),
},
module: {
type: isServer ? 'commonjs' : 'es6',
},
},
}),
},
};

export default config;
33 changes: 19 additions & 14 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,28 @@ const config = {
},
}),

webpack: {
jsLoader: (isServer) => ({
loader: require.resolve('swc-loader'),
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
target: 'es2017',
webpack: {
jsLoader: (isServer) => ({
loader: require.resolve('swc-loader'),
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
module: {
type: isServer ? 'commonjs' : 'es6',
transform: {
react: {
runtime: 'automatic',
},
},
target: 'es2017',
},
}),
},
module: {
type: isServer ? 'commonjs' : 'es6',
},
},
}),
},
};

export default config;

0 comments on commit 024ead8

Please sign in to comment.