You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dynamic entries do not seem to be well supported by webpack-dev-server.
The DynamicEntryPlugin is a poorly documented webpack feature, but the webpack entry option can be defined as a function that returns either an entry object or one that returns a Promise which resolves to an object.
For one, the entry function is not expected to accept any arguments, so passing devClient into the function is a bit confusing. This won't necessarily add the devClient to the resulting entry object unless it was defined by the user in such a way that it uses that argument. Why not append it to the final entry object yourself so you can be sure it is included?
This also redefines the wpOpt.entry as a static object by running the function, rather than keeping it dynamic by, say, wrapping the function in another closure that can re-run and re-append devClient each time it is invoked.
Async functions are completely broken. Since this code resolves the function, an async wpOpt.entry function would resolve to a Promise object and webpack will throw an error because it does not expect this.
I'd be happy to open a PR to fix this if it would be accepted.
The text was updated successfully, but these errors were encountered:
Dynamic entries do not seem to be well supported by webpack-dev-server.
The
DynamicEntryPlugin
is a poorly documented webpack feature, but the webpackentry
option can be defined as a function that returns either an entry object or one that returns a Promise which resolves to an object.e.g.
This was sort of addressed with #801 and #802 in which the following lines were added in /lib/util/addDevServerEntrypoints.js:
However this is incorrect for several reasons:
For one, the
entry
function is not expected to accept any arguments, so passingdevClient
into the function is a bit confusing. This won't necessarily add thedevClient
to the resulting entry object unless it was defined by the user in such a way that it uses that argument. Why not append it to the finalentry
object yourself so you can be sure it is included?This also redefines the
wpOpt.entry
as a static object by running the function, rather than keeping it dynamic by, say, wrapping the function in another closure that can re-run and re-appenddevClient
each time it is invoked.Async functions are completely broken. Since this code resolves the function, an async
wpOpt.entry
function would resolve to aPromise
object and webpack will throw an error because it does not expect this.I'd be happy to open a PR to fix this if it would be accepted.
The text was updated successfully, but these errors were encountered: