Skip to content
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

Missing module error in tree-shaked dll modules #10475

Closed
skimi opened this issue Feb 28, 2020 · 0 comments
Closed

Missing module error in tree-shaked dll modules #10475

skimi opened this issue Feb 28, 2020 · 0 comments

Comments

@skimi
Copy link

skimi commented Feb 28, 2020

Bug report

What is the current behavior?

A module is missing in the dll chunk causing an error:

Uncaught TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (dll.js:21)
    at Module../test-package/index.js (dll.js:121)
    at __webpack_require__ (dll.js:21)
    at Module../dll.js (dll.js:95)
    at __webpack_require__ (dll.js:21)
    at Object.<anonymous> (index.js:107)
    at __webpack_require__ (index.js:20)
    at Module.<anonymous> (index.js:100)
    at __webpack_require__ (index.js:20)
    at Object.<anonymous> (index.js:91)

A library needs to re-export one of it's module in two steps like constants below to get this bug:

// index.js of 'test-package'
import * as _constants from './constants';
export var constants = _constants;
export { default as someOtherFunction } from './someOtherFunction';

Then if you try to import import { constants } from 'test-package' in your dll. The end chunk will have a reference to the module ./someOtherFunction but it won't actually be in the chunk causing the above error.

This only happens in a DLL

If the current behavior is a bug, please provide the steps to reproduce.

https://github.com/skimi/webpack-dll-bug

What is the expected behavior?

Missing module reference either completely removed because it can totally be tree-shaked or it can't at all and it should be kept in the chunk.

Other relevant information:

I got this error while using the redux-form library that has this kind of export.
Related issue at redux-form redux-form/redux-form#4618

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant