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

Parcel cannot build vega-lite #7099

Closed
ross-pfahler opened this issue Oct 15, 2021 · 7 comments
Closed

Parcel cannot build vega-lite #7099

ross-pfahler opened this issue Oct 15, 2021 · 7 comments

Comments

@ross-pfahler
Copy link

ross-pfahler commented Oct 15, 2021

🐛 bug report

Parcel cannot build vega-lite without errors.

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

See: https://github.com/ross-pfahler/parcel-2-demos/blob/vega-lite-bug/babel.config.json

{
  "plugins": [
    "@babel/plugin-proposal-class-properties"
  ],
  "presets": [
    "@babel/preset-env",
    "@babel/preset-typescript"
  ]
}

🤔 Expected Behavior

Vega lite should be built.

😯 Current Behavior

@parcel/optimizer-terser: Invalid assignment

    5930 | $parcel$export(module.exports, "debug", () => $ffdfccca23e11389$export$1c9f709888824e05, (v) => $ffdfccca23e11389$export$1c9f709888824e05 = v);
  > 5931 | $parcel$export(module.exports, "message", () => (parcelRequire("7rYOT")), (v) => (parcelRequire("7rYOT")) = v);
  >      |                                                                                                          ^ Invalid assignment
    5932 | 
    5933 | var $10yO6 = parcelRequire("10yO6");

  💡 It's likely that Terser doesn't support this syntax yet.

I believe the error is coming from: https://github.com/vega/vega-lite/blob/master/src/log/index.ts#L5-L6

💁 Possible Solution

Not sure of solution; there is a work around using an alias to alias to the es5 build for now (eg "vega-lite": "vega-lite/build/vega-lite.js")

🔦 Context

Trying to build a project with vega lite.

💻 Code Sample

https://github.com/ross-pfahler/parcel-2-demos/tree/vega-lite-bug.

To reproduce:

yarn install
yarn build

🌍 Your Environment

Software Version(s)
Parcel 2.0.0
Node . 14
npm/Yarn . yarn 1
Operating System . osx
@mischnic
Copy link
Member

I would say this situation of using @babel/preset-env instead of the recommended @parcel/babel-preset-env is unsupported, this causes all kinds of miscompilations and increased build size (because it first transpiles ESM to CJS, and then Parcel has to analyze the CJS). Can you change that?

I guess we should should emphasize this in the warning when using @babel/preset-env.

@ross-pfahler
Copy link
Author

Yes, it did work (I removed the babel config completely). We have run into a few other issues using @parcel/babel-preset-env (they are logged), so we can't switch 100% over for all our projects.

As a work around I mentioned we can use the alias property for now which works fine.

I would still consider this a bug as I imagine others could hit snags like this when upgrading to v2, but of course up to y'all on how supported @babel/preset-env should be.

@mischnic
Copy link
Member

We have run into a few other issues using @parcel/babel-preset-env (they are logged), so we can't switch 100% over for all our projects.

Did you open/find existing Github issues for them? I didn't even know that there were any problems.

There isn't anything we can do about @babel/preset-env because Parcel cannot control how much is transpiled without @parcel/babel-preset-env.

@JaredSartin
Copy link

I am hitting similar, trying to trace what isn't found.

@dorukde
Copy link

dorukde commented Apr 28, 2023

I ran into the same issue, and I couldn't figure out a way out (outside of --no-minify or --no-optimize).

@devongovett
Copy link
Member

Related: #8467, microsoft/TypeScript#50761

@devongovett
Copy link
Member

Fixed by #9318 #9330

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

No branches or pull requests

5 participants