Skip to content

Commit e2d96dd

Browse files
committed
update
1 parent d89a30a commit e2d96dd

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

src/getWebpackConfig.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ const imageOptions = {
2828
};
2929

3030
interface GetWebpackConfigFunction {
31-
(modules?: boolean): Configuration[];
31+
(modules?: boolean, options?: { enabledReactCompiler?: boolean }): Configuration[];
3232
webpack: typeof webpack;
3333
svgRegex: RegExp;
3434
svgOptions: typeof svgOptions;
3535
imageOptions: typeof imageOptions;
3636
}
3737

38-
const libDir = process.env.LIB_DIR || 'components';
38+
const getWebpackConfig: GetWebpackConfigFunction = (modules, options = {}) => {
39+
const { enabledReactCompiler } = options;
3940

40-
const getWebpackConfig: GetWebpackConfigFunction = (modules?: boolean): Configuration[] => {
4141
const pkg: PackageJson = readJsonSync(getProjectPath('package.json'));
4242

4343
const babelConfig = getBabelCommonConfig(modules || false, {
44-
enabledReactCompiler: libDir === 'dist',
44+
enabledReactCompiler: enabledReactCompiler,
4545
});
4646

4747
babelConfig.plugins.push([
@@ -104,13 +104,7 @@ const getWebpackConfig: GetWebpackConfigFunction = (modules?: boolean): Configur
104104
'readline',
105105
'repl',
106106
'tls',
107-
].reduce(
108-
(acc, name) => ({
109-
...acc,
110-
[name]: false,
111-
}),
112-
{}
113-
),
107+
].reduce((acc, name) => ({ ...acc, [name]: false }), {}),
114108
},
115109

116110
module: {

0 commit comments

Comments
 (0)