mastilver/dynamic-cdn-webpack-plugin

webpack require undefined when used alongside NamedModulesPlugin

Connorelsea opened this issue · 9 comments

I am getting this error when attempting to integrate this into my webpack config. I am using this webpack config: https://github.com/Connorelsea/react-typescript-starter/blob/master/webpack.prod.js

image

Yep managed to reproduced it, I will try to find what's the issue here

In the meantime, let me know if you find where it's coming from!

Looks like it's caused by NamedModulesPlugin, which is weird because I'm using it as well on my project without any issue :/

What version of NamedModulesPlugin/webpack are you using and what order should it be included in?

I'm using webpack@2 and it doesn't have to do with the order

I've got a failing test, I'm now trying to find where it's coming from :)

So yeah, this issue is only happening on webpack@3

Released in 3.4.0

This fixed it for me. Thanks a ton! @mastilver

Getting a 98 in performance on light house using this in my build

image

@Connorelsea Which is better or worst?

Depends on the context but the majority of the time, the first visit is slower than not using this plugin
But on the long term, it becomes handy as your dependencies don't update as much as your code, so your users won't need to re-download your dependencies again and again