Hello, thank you for this wonderful tool! I use it every day, it literaly save my life.
I just found out a weird behavior.
I have notice that _Build will contain JS files in src/ folder EVEN if you are not using(not importing them)._
Say if I have a test.js file inside src/ directory
export default {
str: `I will be include in build even if nobody importing or using me.`
}
I don't know if this is a feature or not, because if you include unused(not imporing) JS in build like above I show you, then you can _dynamic_ require('./unused.js') your JS file, which seems a feature to everybody.
I want to ask if it is good or not, because I can't find anything in the doc(new website) that related to this .
Thank you very much!!!!
Today, I have found out that how to trigger this situation.
if (true) {
const a = require(`./${data.long.long.attribute}`);
}
if webpack can determine you are _using require_, and your require is not _statically define_ (even if that's just a long object's attribue name), then webpack will add _ALL JS in src/ directory to build_
Ah, yes. This is a known limitation of webpack. If you use a dynamic require webpack has no other option than to bundle everything. The only way to fix this is via proper imports.
Most helpful comment
Ah, yes. This is a known limitation of webpack. If you use a dynamic require webpack has no other option than to bundle everything. The only way to fix this is via proper imports.