Created
November 24, 2019 23:38
-
-
Save ScriptedAlchemy/6840c4b2486c3b266d3f2f7c474ebaa4 to your computer and use it in GitHub Desktop.
Tree-shaking drops interleaved modules if not used
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import Nav from './components/Menu' //Didnt use {MobileNav}, will be tree shaken | |
| export default class App extends React { | |
| render(){ | |
| return (<Nav>) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import ExternalImport,{importDependenciesOf} from 'webpack-external-import' | |
| export default class App extends React { | |
| render(){ | |
| // MobileNav isnt going to be there, webpack will tree-shake it out because app1 didnt use it | |
| return (<ExternalImport src={importDependenciesOf('http://localhost:3002', 'somenamespace', 'Nav')} export="MobileNav"/>) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment