web icon indicating copy to clipboard operation
web copied to clipboard

Non-required files are somehow being included (and called) in bundle

Open scottmas opened this issue 4 years ago • 0 comments

Hey, I've discovered a weird bug likely somewhere deep in the webpack config: I have a dist directory (I'm using Typescript) that occasionally has old non-required files inside of it. My app entry point and all the branches from the entry point never reference the files. In all my years of dev, it has never been a problem having these orphaned files sitting around. No other file is requiring them and all is well and good.

However, somehow these non-required files are being included in my Webpack bundle for Expo web, making my app blow up in weird and obscure ways. When I rm -rf my dist directory and do a fresh Typescript compile on everything, the problem goes away and since the files no longer exist they are excluded from the bundle and my app works again.

There's clearly a workaround here (just clean your dist directory after renaming) but this just seems wrong and problematic to me. Is there some weirdness deep in the webpack config?

scottmas avatar Sep 05 '19 00:09 scottmas