-
Notifications
You must be signed in to change notification settings - Fork 50
TypeError: webpack-hot-client: entry
Object values must be an Array
#11
Comments
@shellscape Will we be seeing a new release of koa-webpack soon? |
Ahh nevermind. Just noticed koa-webpack's package.json. webpack-hot-client@^1.0.1 will satisfy this release. 👍 |
@shellscape I'm getting this error
Unrelated to |
@EvHaus if you're passing a config to webpack-serve, it'll take care of wrapping the entry for you: https://github.com/webpack-contrib/webpack-serve/blob/master/index.js#L21 If you're passing a compiler to webpack-serve, you'll need to wrap your string entry in an array. This is a requirement, and the only config requirement for webpack-hot-entry. |
Hmm. I'm passing a plain JS config like so:
And |
OK, that's the edge case then - an object naming entries. Open an issue in |
@shellscape I'm not sure this is an edge case as it's the recommended "scalable" configuration option https://webpack.js.org/concepts/entry-points/#object-syntax Would you be open to me moving your work from webpack-contrib/webpack-serve@7ab2f76 downstream so that webpack-hot-client will work with configs using object entries? |
@amccloud I'm afraid not. |
@shellscape bummer. Funny that you mention that, i'm migrating from I just need webpack-dev-middleware to fallback to index.html 🙃 |
@amccloud man I just played myself, didn't I 😄 That is a bummer for sure. So if you insert a content/static middleware before webpack-dev-middleware, you should be able to pull that off. You just need to set it up so that 404s pass-through to WDM. Failing that, if you can put together a repo for me to play with, I might be able to figure out your setup to make this work. This whole array requirement is due to a limitation in webpack whereby we can't inject entries after webpack is instantiated and loads a config unless it thinks it's working with a MultiCompiler. I would really love to get some people rallying for a change there, but I haven't had any takers yet. If we can't get your repo working with this, we might (heavy emphasis) be able to roll a |
Do you mean something like historyApiFallback? My goal is to match my development environment to production. In production, all routes use historyApiFallback so that I've also tried the double-before/after dev middleware setup mentioned in webpack/webpack-dev-middleware#44 (comment)
I think I may still have a MultiCompiler with this config? entry: {
'example': ['webpack-hot-middleware', './src/example']
} |
Code
Expected Behavior
Should not throw above error since
entry
is an array.Actual Behavior
Throws
TypeError: webpack-hot-client:
entryObject values must be an Array
For Bugs; How can we reproduce the behavior?
Just try using an array in the entry section.
This is a bad check.
const type = typeof entry
will reportobject
for arrays.Doing a
console.log
immediately after that line (I modified local node_modules) produces this which only confirms my assertion:Because of that L#132 gets executed which causes this error.
The text was updated successfully, but these errors were encountered: