-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Destructuring doesn't work on strings in a .ts
file bundled by parcel
#12456
Comments
Hey @danieltroger! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
|
I figured out that
Is the same as
But I'm sad that the magic of babel "just working" got destroyed as So a possible solution would to transpile such cases to |
You are using Babel 6, which is not supported, please upgrade to Babel 7 and see if it is reproducible. |
Hello, thank you for your response. I was not aware I was using an old version :( I ran this:
envinfo now looks like this:
The code now was transpiled to this (I deleted my dist directory so this is freshly generated):
The error persists:
|
Try uninstalling |
I can not reproduce your issue on REPL (Babel 7): There is reason why we ask you to provide an REPL link in the issue template when you create a bug report. It will be great if you can share a reproduction repo, otherwise we can only guess what may be going wrong, e.g. Did you install |
Oh my god, it can actually do it, there's hope! Thanks a lot for that REPL link, it was awesome to see it transpile. I think many more people would use it if it actually was usable like the one you sent, i.e. you put code on one side and on the other there's output transpiled by babel. The one in the issue template which didn't 404 (like the slack invite link) puts you into some react situation and I tried to add code there but it didn't get executed. I didn't bother to figure out how to configure that thing correctly and proceeded without. Here's a "reproduction repo": https://filebin.net/77524fgxrpmfzo5h You need to run I don't have any babel globally
I suppose, it's in packages.json
Doesn't help |
FYI, this is where I get when I click on the repl link in the issue template: https://github.com/babel/babel/issues/babeljs.io/repl and there's a 404 error And this is the other one: https://codesandbox.io/s/babel-repl-custom-plugin-7s08o?file=/src/index.js |
The reproduction repo uses |
.ts
file bundled by parcel
@devongovett Maybe you know what could be causing the problem? |
Parcel 1 uses TSC for compiling typescript files, not babel. I would report this issue to TS instead. Here's a reproduction: https://www.typescriptlang.org/play?noImplicitAny=false&target=1#code/GYVwdgxgLglg9mABMOAnAtgQygB1TCAUwAo8DCBKAbwChFEIEBnKRAbQDouyiB9TVKkwBPALqIAvIgByIdACNCqUviIUOUOAGUo+MAHNiFANx1EAG0KtUhAG5KmhACa8ehSYjf9BIjjfuojkYANGYoGNhQzq6q7lJsoqb0-g7RbhzhAKKYEAAWxMR5AjlRqMGIMGBOhAAeFJIAfMhoWFBRLuk4IEz5XBzEldU1iABkI4gAhANVtYgApIgAzPUA-OwARIjr5UVC0EriAFzsuyUHFBdJiDZQIKhI4a3tMeR+dqlGHABWcJXE6+sTDQAL40GiPbBuYgARgATIsACwAVgAbAB2AAcAE5oQAGCg0IA |
Thanks! I'm closing this issue since it's not a Babel bug. |
Thanks a lot guys for the help! I searched the typscript issues and apparently it's expected behaviour?????? They're nuts. I don't see any benefits of typescript, all I want is my code to be transpiled to work in all browsers IE11 and newer, so I tried to switch to babel.
And it worked! I had issues before with .js files not getting transpiled (especially async functions) which was why I used I had to add this though to make it not complain about an unexisting regeneratorRuntime https://babeljs.io/docs/en/babel-plugin-transform-runtime @devongovett you're saying "Parcel 1", is there something newer and better? I tried browsing the parcel site but it's not clear if there's a new version. There's this project which says "closed" but the progress bar isn't finished. And here it says that the old docs are outdated, suggesting there might be a new version? But further up it says @JLHwung sorry for hijacking this but as a fresh babel user, is it possible to automatically get polyfills just for the functions I use? Setting corejs of "@babel/plugin-transform-runtime" to false makes the output 139KB smaller but does the |
Bug Report
Current behavior
Input Code
Expected behavior
This is what happens in the newest versions of chrome and firefox when not transpiling with babel
What happens instead?
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
.babelrc
Environment
cli
Possible Solution
Additional context
It gets transpiled to this:
The text was updated successfully, but these errors were encountered: