Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

[4.0.0-alpha.0] Cannot read property 'moduleExports' of undefined #727

Closed
tzimmermann opened this issue Feb 26, 2018 · 5 comments
Closed

Comments

@tzimmermann
Copy link

tzimmermann commented Feb 26, 2018

I get TypeError: Cannot read property 'moduleExports' of undefined after upgrading to webpack 4 and the new alpha of the extract-text plugin:

"extract-text-webpack-plugin": "4.0.0-alpha.0",
"webpack": "4.0.0"

The stack trace points to .chunkModule.source() being called without parameter here, which leads to the runtime variable being undefined here

This looks like the same line is causing this as in #722.

EDIT: I can confirm that the issue is related to dynamic module loading: If I remove all dynamic import statements, the error goes away (see #722 (comment))

Here's the full stack trace:

/Users/tz-mac/Repos/pex-client/node_modules/webpack/lib/DelegatedModule.js:66
                        str = `module.exports = (${runtime.moduleExports({
                                                          ^

TypeError: Cannot read property 'moduleExports' of undefined
    at DelegatedModule.source (/Users/tz-mac/Repos/pex-client/node_modules/webpack/lib/DelegatedModule.js:66:38)
    at Function.renderExtractedChunk (/Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/dist/index.js:115:38)
    at ExtractTextPlugin.extractedChunks.forEach.extractedChunk (/Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/dist/index.js:298:46)
    at Array.forEach (<anonymous>)
    at compilation.hooks.additionalAssets.tapAsync.assetCb (/Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/dist/index.js:286:25)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/tz-mac/Repos/pex-client/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/tz-mac/Repos/pex-client/node_modules/tapable/lib/Hook.js:35:21)
    at hooks.optimizeTree.callAsync.err (/Users/tz-mac/Repos/pex-client/node_modules/webpack/lib/Compilation.js:939:32)
    at _err0 (eval at create (/Users/tz-mac/Repos/pex-client/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:11:1)
    at _async2.default.forEach.err (/Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/dist/index.js:281:11)
    at /Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:998:13)
    at /Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:906:16
    at _async2.default.forEach.err (/Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/dist/index.js:259:13)
    at /Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/tz-mac/Repos/pex-client/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:998:13)
@kaiyoma
Copy link

kaiyoma commented Feb 26, 2018

I'm also running into issues when trying to upgrade to webpack 4.0. yarn check spits this out:

error "extract-text-webpack-plugin#webpack@^3.1.0" doesn't satisfy found match of "webpack@4.0.0"

@michael-ciniawsky
Copy link
Member

@kaiyoma

npm i -D extract-text-webpack-plugin@next

extract-text-webpack-plugin@3.0.0 will 💯 break with webpack >= v4.0.0 :)

@Jessidhia
Copy link
Contributor

Jessidhia commented Feb 27, 2018

This is related to #722; the difference being that this also involves DllPlugin.

@michael-ciniawsky
Copy link
Member

Released in v4.0.0-beta.0 🎉

@tzimmermann
Copy link
Author

@michael-ciniawsky Thanks a lot, working now for me, too!

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

No branches or pull requests

4 participants