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 production bundle: Incompatible receiver, Map required #4692

Closed
smeijer opened this issue Jun 4, 2020 · 8 comments
Closed

Error in production bundle: Incompatible receiver, Map required #4692

smeijer opened this issue Jun 4, 2020 · 8 comments

Comments

@smeijer
Copy link
Contributor

smeijer commented Jun 4, 2020

🐛 bug report

When including aria-query in my project, parcel serve works fine, but parcel build will result in a non-working state. The app will throw

Incompatible receiver, Map required

🎛 Configuration (.babelrc, package.json, cli command)

package.json:

{
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html && http-server dist",
  },
  "devDependencies": {
    "http-server": "^0.12.3",
    "parcel-bundler": "^1.12.4"
  },
  "dependencies": {
    "aria-query": "^4.0.2"
  }
}

index.html:

<html>
<body>
  <div id="app"></div>
  <script src="./index.js"></script>
</body>
</html>

index.js:

import { roles } from 'aria-query';
console.log('roles', roles);

🤔 Expected Behavior

As the app is running just fine in serve mode, (logs a message to console), the app should also run when being build with parcel build.

😯 Current Behavior

An error is thrown:

internal-state.js:20 Uncaught TypeError: Incompatible receiver, Map required
    at internal-state.js:20
    at new <anonymous> (collection.js:49)
    at Object.parcelRequire.Xyow.@babel/runtime-corejs3/helpers/interopRequireDefault (ariaPropsMap.js:15)
    at f (tabpanelRole.js:25)
    at p (tabpanelRole.js:25)
    at Object.parcelRequire.EvzN.@babel/runtime-corejs3/helpers/interopRequireDefault (index.js:13)
    at f (tabpanelRole.js:25)
    at p (tabpanelRole.js:25)
    at Object.parcelRequire.Focm.aria-query (index.js:1)
    at f (tabpanelRole.js:25)

💁 Possible Solution

I don't have the solution, but it looks like it has something to do with core-js and Map being poly-filled more than once? But I'm not sure.

🔦 Context

I need to include aria-query into my client side bundle, but so far I'm unable to doing so, because of the error that is present in the production bundle (but not when running parcel serve).

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel v1.12.4
Node v12.16.1
npm v6.14.0
Operating System Ubuntu 19.10
@mischnic
Copy link
Member

mischnic commented Jun 4, 2020

The serve mode output is on the left (working=, build mode on the right (broken):

Bildschirmfoto 2020-06-04 um 22 40 11
so when some core-js files import "hidden-keys" they actually get "path".

This is somehow caused by deduping assets when writing the bundle (commenting this out fixes the above):


Ideally, aria-query would also publish a modern build to npm (ESM imports, native Maps, ...)

Works with Parcel 2...

@smeijer
Copy link
Contributor Author

smeijer commented Jun 5, 2020

Thanks for the research. I've created a ticket at the aria-query repo.

But until Parcel 2 is released as the recommended release (non-alpha), I think it's worth fixing here as well.

As a quick fix, we could make the deduping optional? Although it might be better to figure out how deduping is causing this.

@jessebeach
Copy link

@smeijer aria-query can't be the only project in the dependency tree using @babel/plugin-transform-runtime. Maybe the error shows up for aria-query because it appears alphabetically first?

@smeijer
Copy link
Contributor Author

smeijer commented Jun 13, 2020

I haven't verified, but that sounds plausible.

@sandrina-p
Copy link

The same problem is happening in a project that uses the latest Parcel 1.12.4 and parse 2.17.0. dev is fine but the build breaks.
Any suggestion?

Project source code: https://github.com/majac91/Travel_journal - Exact commit

@MarkLyck
Copy link

MarkLyck commented Feb 2, 2021

Sorry to bump, but any news on this? same problem: "parcel-bundler": "1.12.4",

I don't use aria-query so that's not the only package tripping up the build.

@github-actions
Copy link

github-actions bot commented Aug 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Aug 2, 2021
@quaos
Copy link

quaos commented Apr 21, 2022

Just run into this in 2022, without aria-query.

I'm using @parcel/babel-plugin-transform-runtime with corejs version: 3 to try to fix regeneratorRuntime not defined issue.

@github-actions github-actions bot removed the Stale Inactive issues label Apr 21, 2022
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

6 participants