Closed rgrove closed 8 years ago
+1 on this. To avoid this error I had to change:
require.ensure([], (require) => {
cb(null, require('../containers/FormContainer/FormContainer.js'));
});
to:
require.ensure([], (require) => {
cb(null, require('../FormContainer/FormContainer.js'));
}, 'Form');
@rgrove: On a side note, I had a heck of a time figuring out that this plugin was the source of my error. How did you get that stack trace? I was running webpack through Grunt, and only got the TypeError
with no additional detail.
@stevenp I'm running the webpack CLI directly here. It's been a while since I last used Grunt, but I seem to recall it hides stack traces unless you pass --stack
on the command line. Maybe that's why you didn't see a stack trace?
Yeah, #14 was merged before I had a chance to revisit it. I never ran into this issue when I was working on it, probably because I'm not doing code splitting. If anyone could share a failing test or example project to replicate this so I can see how it's being used, I'm happy to work on fixing it.
I started a forked branch with a failing test here:
https://github.com/npbee/webpack-manifest-plugin/blob/unamed-chunks/spec/plugin.spec.js#L181
Happy to send it as a PR if you'd like to work off of it. My use case here (and I suspect for @stevenp based on the example) is for dynamically loading routes via React Router, so a good example app if you need it could be this one from their docs: https://github.com/reactjs/react-router/tree/master/examples/huge-apps.
I am seeing this issue as well. The problem is "chunk.name" is null in some cases.
We can look into upstream see how to make sure "chunk.name" always exist. Or in the plugin, we can use some other alternatives as name like: chunk.modules[0].userRequest
I don't know which way might give us reliable name.
Any comments?
With Webpack 2 we can use System.import (instead of require.ensure) which doesn't allow the naming of chunks (as per the loader spec).
The Webpack team have indicated they won't deviate from the loader spec i.e. they will not support naming System.import chunks https://github.com/webpack/webpack/issues/1949
Also seeing this issue.
Updates to PR: https://github.com/danethurber/webpack-manifest-plugin/pull/17. Exceptions are fixed, and nameless chunks report their generated files into the manifest.
As of commit 2ff2950f (which landed in version 1.0.0), webpack-manifest-plugin throws the following exception when it encounters a nameless chunk:
It looks like @shamrin called this out as a bug in PR #14, but for some reason it was never fixed and the PR was merged anyway.