I was working on a project when I stumbled upon a weird problem where Webpack inserted some Javascripts into the compiled SCSS file. I thought I misconfigured something, turned out it was a bug with Webpack 4. I spent many hours debugging the problem, since there’s very few discussions and resources about this on Google (or perhaps I used the wrong keywords?), before I found this thread mentioning the problem was related to dynamic imports:


Once I removed dynamic imports from my code, the problem was solved!

The good thing is, while browsing around the solutions for the problem, I found some pretty useful resources about Laravel Mix:



There you go. I hope this post could save hours of your work.