While investigated slow build times in our app, I found that every single file that matches the extensions setting in webpacker.yml is set to be an entry file. I might be wrong here, but that may not be necessary.
In my testing, I've found only setting the files that use javascript_pack_tag or stylesheet_pack_tag are needed to properly build and compile all the types of static assets.
I'm super curious about this and want to know if anyone has any insight.
Thanks! 馃憤
I'm still learning Webpack and noticed this too. The webpacker README seems to indicate that only the files in the root of the packs dir will be entry points. However, I think that all source files are being built and emitted as separate possible entry points.
I modified the extensionGlob in shared.js to remove the recursive search ("**/*{$... -> "*{$...) and now my entry points are just the top level files.
Though it didn't seem to make much difference to compilation time!
@scottcorgan Only the files that are put under packs folder are matched. Please make sure to remove other source file out of the packs folder to app/javascript and only keep entry files inside packs folder.
app/javascript:
- calender.js
- chat.js
- src/components/chat.js
- # etc....
packs:
- main.js # imports child components and bootstrap
@Odaeus Yes that doesn't add anything however please make sure to not have all the JS files inside packs folder - only entry files needs to be here.
Thanks @gauravtiwari, I guess I wasn't paying close enough attention to the README, oops!
Is there something in the README you could link to about this?
@scottcorgan I will make a PR and add a section for this 馃憤
Hey thanks, that tripped me up too!
Addressed in #710
Most helpful comment
@scottcorgan I will make a PR and add a section for this 馃憤