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

Tests to verify that sub-package bundles are valid ESM and package.json fields are correct #1374

Closed
keller-mark opened this issue Dec 15, 2022 · 4 comments
Labels
devops feature New feature or request tech debt Things that we know need work

Comments

@keller-mark
Copy link
Member

User story

I want to import functions from the package @vitessce/vit-s from a CDN (i.e., the dist/index.js main file).

Preferred solution

Add Cypress test that checks that the build can be imported into a plain HTML file as an ES module.

Possible alternatives

  • Run the code through a CLI (node, typescript, esbuild, etc) that will throw an error if the code is not valid ESM
@keller-mark keller-mark added feature New feature or request devops tech debt Things that we know need work labels Dec 15, 2022
@ilan-gold
Copy link
Collaborator

ilan-gold commented Dec 15, 2022

@keller-mark Have you tried this? At least with Viv, the issue is not the validity of the ES code but the chain of global imports we have (which are a no-go in the browser). I think we need to create a true "bundle" if we want to do this, but I could be mistaken. deck.gl releases a minified bundle I think for this exact reason.

@keller-mark
Copy link
Member Author

Ah yes that is true, we might need to use Vite/Rollup/esbuild/etc to generate a real bundle.

In addition to the global imports, the lack of .js extensions on local imports is another thing preventing direct usage of the current code in dist/

@keller-mark
Copy link
Member Author

Related: https://github.com/bluwy/publint can run locally

@keller-mark keller-mark changed the title Ensure that sub-packages are valid ESM Tests to verify that sub-package bundles are valid ESM and package.json fields are correct Feb 10, 2023
@keller-mark
Copy link
Member Author

See #1441 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops feature New feature or request tech debt Things that we know need work
Projects
None yet
Development

No branches or pull requests

2 participants