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

fix: avoid including duplicate import map if it's imported from program #111

Merged

Conversation

magurotuna
Copy link
Member

This commit ensures that one import map appears just once in the generated eszip.

Fixes #110

Now a generated eszip works fine with eszip_builder and eszip_viewer.

eszip_builder

$ cargo run --example eszip_builder file://$(pwd)/main.js out.eszip file://$(pwd)/import_map.json
source: file:///Users/yusuktan/Repo/github.com/magurotuna/eszip/import_map.json
source: file:///Users/yusuktan/Repo/github.com/magurotuna/eszip/main.js

eszip_viewer

$ cargo run --example eszip_viewer out.eszip
Specifier: file:///Users/yusuktan/Repo/github.com/magurotuna/eszip/import_map.json
Kind: Json
---
{
  "imports": {
  }
}

---

============
Specifier: file:///Users/yusuktan/Repo/github.com/magurotuna/eszip/main.js
Kind: JavaScript
---
import m from "./import_map.json" assert { type: "json" };

---

============

Copy link
Member

@satyarohith satyarohith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - nice test!

@magurotuna magurotuna merged commit d1cbdd8 into denoland:main Feb 7, 2023
@magurotuna magurotuna deleted the import_map_imported_from_program branch February 7, 2023 01:56
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

Successfully merging this pull request may close these issues.

Invalid eszip is generated if an import map is imported from a program
2 participants