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

Deno bundle produces reference error #9350

Closed
dev-nicolaos opened this issue Jan 31, 2021 · 13 comments
Closed

Deno bundle produces reference error #9350

dev-nicolaos opened this issue Jan 31, 2021 · 13 comments
Labels
bug Something isn't working correctly swc related to swc (bundling/transpiling)

Comments

@dev-nicolaos
Copy link
Contributor

dev-nicolaos commented Jan 31, 2021

Environment

  • Windows 10 Home version 20H2
  • Observed as early as Deno version 1.7.2, still present in 1.9.0

Steps to reproduce

  • Clone the example repo: https://github.com/dev-nicolaos/deno-bundle-bug
  • In the repo's top level folder, run deno run --unstable --import-map=import_map.json mod.ts
  • Observe that the program runs and exits without any errors
  • In the repo's top level folder, run deno bundle --unstable --import-map=import_map.json mod.ts bundle.js
  • In the repo's top level folder, run deno run bundle.js (with or without the --unstable flag)

Observed behavior

The program exits with an Uncaught ReferenceError

Expected behavior

The program runs successfully just as it did before it was bundled, and exits without any errors

Notes

The example repo here is admittedly a bit contrived, I'm having this problem in a much larger project and essentially removed as much of it as I could while still being able to reproduce the error. This has been an issue for at least the last few versions of deno, and the same thing happens when using the deno compile command. I've also tried this (in the larger project) on Ubuntu (running on WSL) with the same results.

@kitsonk kitsonk added bug Something isn't working correctly swc related to swc (bundling/transpiling) labels Jan 31, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Jan 31, 2021

cc/ @kdy1

kdy1 added a commit to kdy1/swc that referenced this issue Feb 1, 2021
@kdy1
Copy link

kdy1 commented Feb 1, 2021

FIxed on upstream

@bartlomieju
Copy link
Member

Done in #9374

@dev-nicolaos
Copy link
Contributor Author

@bartlomieju @kdy1 I just ran this through the same steps to reproduce with Deno v1.7.2 and Deno std v0.86.0, and it appears the bug is still present. I updated the import map in the example repo.

@bartlomieju bartlomieju reopened this Feb 5, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Feb 8, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Feb 16, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Feb 19, 2021
@dev-nicolaos
Copy link
Contributor Author

My understanding is this has been fixed in swc, but I haven't seen Deno pull in a new version in a while. Any chance the dependency could get bumped before the next release?

@lucacasonato
Copy link
Member

@dev-nicolaos we updated just before the 1.8 release on tuesday.

@dev-nicolaos
Copy link
Contributor Author

ah, missed it since it was bundled with other upgrades, thanks for pointing it out. Will rerun steps to reproduce on new 1.8.0.

@dev-nicolaos
Copy link
Contributor Author

Bug still present walking through the above steps with Deno v1.8.0 and Deno std 0.89.0 😢

@dev-nicolaos
Copy link
Contributor Author

@kdy1 I just walked through the steps to reproduce again with Deno v1.9.0 and std 0.93.0 since I saw the version of the bundler got bumped, but this still appears to be an issue.

kdy1 added a commit to kdy1/swc that referenced this issue Apr 14, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Apr 15, 2021
kdy1 added a commit to swc-project/swc that referenced this issue Apr 16, 2021
swc_bundler:
 - Fix remapping of exports. (denoland/deno#9350)
@kdy1
Copy link

kdy1 commented Apr 16, 2021

Really fixed on upstream :)

@dev-nicolaos
Copy link
Contributor Author

@bartlomieju @lucacasonato any chance we could see a upgrade to the bundler before the next release? Looks like this and several other bugs (#10112, #10187, #10252) have fixes available in the latest version.

@bartlomieju
Copy link
Member

We'll update it for 1.9.2 in about a week

@dev-nicolaos
Copy link
Contributor Author

Can confirm, fixed in 1.9.2. Thanks for the all the hard work @kdy1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly swc related to swc (bundling/transpiling)
Projects
None yet
Development

No branches or pull requests

5 participants