Skip to content

Commit 7981a3a

Browse files
committed
fix(build): externalize mui and emotion dependencies
Excludes @mui and @emotion from the bundle to reduce size and enforce usage of the host application's instances. This resolves React Context conflicts.
1 parent 3009b1e commit 7981a3a

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

webpack.config.babel.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ export default {
2525
},
2626
globalObject: 'this',
2727
},
28-
externals: {
29-
react: 'react',
30-
'react-dom': 'react-dom',
31-
'styled-components': 'styled-components',
32-
'react-modal': 'react-modal',
33-
'react-icons': 'react-icons',
34-
'@tippyjs/react': '@tippyjs/react',
35-
'tippy.js': 'tippy.js',
36-
},
28+
externals: [
29+
{
30+
react: 'react',
31+
'react-dom': 'react-dom',
32+
'styled-components': 'styled-components',
33+
'react-modal': 'react-modal',
34+
'react-icons': 'react-icons',
35+
'@tippyjs/react': '@tippyjs/react',
36+
'tippy.js': 'tippy.js',
37+
},
38+
/^@mui\/.+$/,
39+
/^@emotion\/.+$/,
40+
],
3741
resolve: {
3842
extensions: ['.tsx', '.ts', '.jsx', '.js', '.json'],
3943
fallback: {

0 commit comments

Comments
 (0)