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

Error in ModuleConcatenationPlugin: The export has no internal name #5314

Closed
jeffijoe opened this issue Jul 18, 2017 · 11 comments · Fixed by #5338
Closed

Error in ModuleConcatenationPlugin: The export has no internal name #5314

jeffijoe opened this issue Jul 18, 2017 · 11 comments · Fixed by #5338

Comments

@jeffijoe
Copy link

jeffijoe commented Jul 18, 2017

Do you want to request a feature or report a bug?

Report a Bug. 🐛 😱

What is the current behavior?

I am getting the following error when using ModuleConcatenationPlugin:

Error: The export "__WEBPACK_MODULE_DEFAULT_EXPORT__" in "./src/client/stores/index.js" has no internal name
    →      at getFinalName (my-app/node_modules/webpack/lib/optimize/ConcatenatedModule.js:29:10)
    →      at info.globalScope.through.forEach.reference (my-app/node_modules/webpack/lib/optimize/ConcatenatedModule.js:395:24)
    →      at Array.forEach (native)
    →      at modulesWithInfo.forEach.info (my-app/node_modules/webpack/lib/optimize/ConcatenatedModule.js:383:29)
    →      at Array.forEach (native)
    →      at ConcatenatedModule.source (my-app/node_modules/webpack/lib/optimize/ConcatenatedModule.js:382:19)
    →      at ModuleTemplate.render (my-app/node_modules/webpack/lib/ModuleTemplate.js:14:31)
    →      at my-app/node_modules/webpack/lib/Template.js:110:28
    →      at Function.from (native)
    →      at Chunk.mapModules (my-app/node_modules/webpack/lib/Chunk.js:163:16)
    →      at HotUpdateChunkTemplate.renderChunkModules (my-app/node_modules/webpack/lib/Template.js:107:26)
    →      at HotUpdateChunkTemplate.render (my-app/node_modules/webpack/lib/HotUpdateChunkTemplate.js:20:30)
    →      at Compilation.<anonymous> (my-app/node_modules/webpack/lib/HotModuleReplacementPlugin.js:122:46)
    →      at Array.forEach (native)
    →      at Compilation.<anonymous> (my-app/node_modules/webpack/lib/HotModuleReplacementPlugin.js:111:37)
    →      at Compilation.applyPlugins1 (my-app/node_modules/tapable/lib/Tapable.js:75:14)
    →      at sealPart2 (my-app/node_modules/webpack/lib/Compilation.js:631:9)
    →      at next (my-app/node_modules/tapable/lib/Tapable.js:138:11)
    →      at Compilation.compilation.plugin (my-app/node_modules/webpack/lib/ProgressPlugin.js:111:6)
    →      at Compilation.applyPluginsAsyncSeries (my-app/node_modules/tapable/lib/Tapable.js:142:13)
    →      at Compilation.seal (my-app/node_modules/webpack/lib/Compilation.js:579:8)
    →      at applyPluginsParallel.err (my-app/node_modules/webpack/lib/Compiler.js:514:17)
    →      at my-app/node_modules/tapable/lib/Tapable.js:225:11
    →      at _addModuleChain (my-app/node_modules/webpack/lib/Compilation.js:481:11)
    →      at processModuleDependencies.err (my-app/node_modules/webpack/lib/Compilation.js:452:13)
    →      at _combinedTickCallback (internal/process/next_tick.js:95:7)
    →      at process._tickDomainCallback (internal/process/next_tick.js:198:9)

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

The file that the error is mentioning looks something like this:

class RootStore {
  // ...
}

const rootStore = new RootStore()
if (process.env.NODE_ENV !== 'production') {
  window.rootStore = rootStore
}

export default rootStore

What is the expected behavior?

No error should be thrown.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

  • Node v8.1.2
  • Webpack 3.3.0
  • macOS Sierra
@nifgraup
Copy link

I got this as well and fixed by changing a default export to named export. Does this have something to do with circular dependencies?

@jeffijoe
Copy link
Author

I fixed it by doing the same, but I'd still say it's a bug, no?

@nifgraup
Copy link

Yes, it's a bug.

@sokra
Copy link
Member

sokra commented Jul 20, 2017

Do you have a repro repo for me?

@jeffijoe
Copy link
Author

@sokra I'm unable to reproduce in a clean app, sorry.

@nifgraup Do you think you are able to reproduce it in a create-react-app app? I've tried myself but not sure what makes it work there and not in my bigger project.

@nodkz
Copy link

nodkz commented Jul 20, 2017

@jeffijoe same thing - cannot reproduce simple example. It seems that babel transformations did some magic that not work with webpack ModuleConcatenationPlugin.

PS. BTW, did you use react-lodable?

@jeffijoe
Copy link
Author

@nodkz I haven't used code splitting since webpack 1, had random runtime failures 2/10 times cause of it.

@nifgraup
Copy link

Minimal repro, use with babel-loader:
entry point a.js:

import b from "./b.js";
export default {};

b.js:

import a from "./a.js";
<a />; // JSX syntax, comment out and error goes away
export default {};

Not a regression, error was there as well in v3.0.0-rc.0.

@joeybaker
Copy link

I'm seeing a similar problem, let me know if I should open a new issue

// file.js
import fetchPonyfill from 'fetch-ponyfill'
const useGlobal = () => 
export const { fetch } = useGlobal() ? global : fetchPonyfill()

When ModuleConcatenationPlugin is active, this results in:

ERROR in chunk main [entry]
bundle.js
The export "fetch" in "./file.js" has no internal name

@sokra
Copy link
Member

sokra commented Aug 2, 2017

Try with latest version, if it's still an issue, create a repro case and open a new issue.

@bf
Copy link

bf commented May 1, 2018

This bug is still an issue.

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

Successfully merging a pull request may close this issue.

6 participants