Now you might call me crazy to say, "you should read the source of your bundled output," even assuming we're talking about the unminified/unobfuscated development build, so I'm not going to tell you to go do that. It was right there in front of me the whole time. One thing helped "flip the switch" more than anything else: understanding the product of a webpack build, the output. To form that mental model, I researched dozens of articles, watched numerous screencasts, and read a lot of source code. My main problem was I didn't have a good mental model how webpack worked. Such was not the case when I first started using webpack ever seen an error like on the console? 'Uncaught TypeError: $(.).fancybox is not a function' With Sprockets, I could require a jQuery plugin through a magic comment (the require directive), and it would "Just Work." I was struggling to switch from Sprockets to Webpacker in a large Rails app. Tl dr Install the webpack-bundle-analyzer to visualize what's included in your webpack bundles and debug common problems.ĭoes webpack feel still a bit scary? Maybe a bit too magical? Too much of WTF is going on here? Get to know your bundles with the webpack-bundle-analyzer
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |