Skip to content

Commit 16633dc

Browse files
committed
Configure rollup to treeshake unused modules
Otherwise rollup inserts `import 'react'` in case the module has side-effects.
1 parent 9a85200 commit 16633dc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.flowconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ component_syntax=true
1616
module.name_mapper='^react-strict-dom$' -> '<PROJECT_ROOT>/packages/react-strict-dom/dist/native/index.js.flow'
1717
module.system.node.resolve_dirname=flow_modules
1818
module.system.node.resolve_dirname=node_modules
19+
react.runtime=automatic
1920
suppress_type=$FlowIssue
2021
suppress_type=$FlowFixMe
2122

packages/react-strict-dom/tools/rollup.config.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ const webConfigs = [
5555
file: path.join(__dirname, '../dist/dom/index.js'),
5656
format: 'es'
5757
},
58-
plugins: [...sharedPlugins]
58+
plugins: [...sharedPlugins],
59+
treeshake: {
60+
moduleSideEffects: false,
61+
},
5962
},
6063
// Runtime
6164
{
@@ -65,7 +68,10 @@ const webConfigs = [
6568
file: path.join(__dirname, '../dist/dom/runtime.js'),
6669
format: 'es'
6770
},
68-
plugins: [...sharedPlugins]
71+
plugins: [...sharedPlugins],
72+
treeshake: {
73+
moduleSideEffects: false,
74+
},
6975
}
7076
];
7177

0 commit comments

Comments
 (0)