-
-
Notifications
You must be signed in to change notification settings - Fork 199
Make webpack-dev-server optional #1336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make webpack-dev-server optional #1336
Conversation
try { | ||
featuresHelper.ensurePackagesExistAndAreCorrectVersion('webpack-dev-server', 'the webpack Development Server'); | ||
} catch (e) { | ||
console.log(e); | ||
process.exit(1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have used isPackageInstalled()
, but I would have to rewrite a lot of logic here to enforce the version, generate the good command, etc...
Adding method
parameter to featuresHelper.ensurePackagesExistAndAreCorrectVersion
was a lot easier and clean.
1196ea9
to
fd49f7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types relying on import('webpack-dev-server').Configuration
need to be changed to use object
instead, as our type declarations cannot depend on optional dependencies
fd49f7d
to
c7dee41
Compare
You think so? I kept |
f51585a
to
ca0bf2f
Compare
Ah, I didn't think about that, I will change that, thanks |
f4cce95
to
34588b4
Compare
34588b4
to
600c943
Compare
Checks are finally green. |
As discussed with @stof, we want to make the webpack-dev-server an optional peer dependency:
JavaScript dependencies are problematic, depending on many sub-dependencies, which in turn depend on more sub-dependencies, and so on... Welcome to the dependency hell!
Even if the dev-server functionality isn't used, the dependency tree is immensely more complex (over 300 additional dependencies), but this is an open door to security holes present in “discrete” (say “little-known”), but over-used dependencies.
In recent months, a sort of “witch-hunt” has been set up by some people in the JavaScript ecosystem, to replace sub-dependencies with lighter alternatives (either another dependency, or a native version) in popular project. I've started doing this on Encore for a few dependencies, and making the webpack-dev-server optional is a big win.
When upgrading Encore to v5, end-users will have to install the
webpack-dev-server
back to use it again.