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
Use .js extensions for imports to so that source is ESM #1519
Conversation
@keller-mark a few things:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments.
"type": "module", | ||
"main": "src/index.js", | ||
"publishConfig": { | ||
"main": "dist/index.min.mjs", | ||
"browser": "dist/index.min.umd.js" | ||
"main": "dist/index.min.js", | ||
"module": "dist/index.min.js", | ||
"exports": { | ||
".": { | ||
"types": "./dist-tsc/index.d.ts", | ||
"import": "./dist/index.min.js" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
"src", | ||
"dist", | ||
"src" | ||
"dist-tsc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #1374 - this PR corrects package.json files to use type: module
and also removes references to UMD builds from package.json files. Those UMD builds are still in dist/
but this effectively hides them as a step towards removing them if there are no issues encountered.
As such, I removed the UMD cypress tests and added cypress tests with https://github.com/keller-mark/dynamic-importmap. I have been testing dynamic-importmap
in other places: it works on observable with the existing ESM builds and on colab with anywidget
Thank you for the review! You are right about the importing Originally, I think the direct within-package exports ( However I think all modern bundlers including Vite and Rollup now support tree-shaking of ESM named imports and are clever/performant enough that the development experience is unaffected. Rollup is even going to be able to tree-shake dynamic imports soon.
We are changing the import statements to conform to the ESM requirements here but our development tools like Vite can still load CommonJS or UMD libraries (albeit with the undesired
As for the others:
|
* Create zod schema for 1.0.16 * Move to separate package * Revert main package.json changes * Use builder functions * wip: previous versions * Upgrade functions * Initial tests * VitS as controlled component * Upgrade in <Vitessce/> * WIP: plugins registered via props (instead of window) * Update schemas * Joint file type schemas and via new plugin mechanism * Refactor plugin classes * Cleanup * Update * More cleanup * Cleanup register functions * Remove plugins file, use default coordination values from plugin objects * Comment * Use superRefine to check for deprecated coordination types * Revert * Fix tests * Extra imports * Try env.d.ts * Update * Update plugin examples * Linting for obsSets view * Comment * Allow ts in vite bundling config * Fix e2e tests * Update * Fix import * Allow empty props * Update * Remove ajv * Update * Update deps * Lint * Fix tests * Implement plugin classes with typescript * Add config uid property * use .length * Fix docs * Update plugin docs * Add config schema versioning docs * Add useCallback calls to obsSetsManager * Remove unnecessary fromEntries * Implement getSourceAndLoader function * Remove extra import * Eslint comment * Demo * Update dev-config-versioning.md * Update docusaurus.config.js * Lint * Make json schemas * Tsconfig * Lockfile * Update deploy script and readme * Simplify pnpm command * Update pnpm lock * Respond to PR feedback * Fix type issues, update docs * Refactor base plugins * Update * Pnpm install * Types in package.json * Fix tsconfig project references * Pnpm lock * Add dev-docs * Working types and linting * pnpm lock * Update * Fix test * Lint * Pnpm lock * React import * React import * More react imports * Update package.json exports in sub-packages, add new test for dynamic importmap * Add comment * Comment * Dev-docs * Add comment * Use dynamic-importmap * Try compressed-size-action * Update * Node options * env * Clean cmd * Revert unrelated github action change * Fix typo * Revert changed ObsSetsManager * Use .js extensions for imports to so that source is ESM (#1519) * Use .js * Comments * Revert webpack plugin * Update cypress e2e tests * Add/move dev-docs * Update design-guidelines.md * Fix meta-updater * Revert config * Update design-guidelines.md * Update README.md * Update design-guidelines.md * Update design-guidelines.md * Update design-guidelines.md * Update rollup.config.js * Revert unrelated change * WIP: clean up lodash, mui, uuid imports * More import fixes * De-duplicate imports * Dev-docs about js imports * Use publint * isEqual * Fix tests * Dev-docs * Dev-docs linked from main README * Demo * Feedback * Use same terminology in docs as code * Troubleshooting note * Upgrade guide
* Create zod schema for 1.0.16 * Move to separate package * Revert main package.json changes * Use builder functions * wip: previous versions * Upgrade functions * Initial tests * VitS as controlled component * Upgrade in <Vitessce/> * WIP: plugins registered via props (instead of window) * Update schemas * Joint file type schemas and via new plugin mechanism * Refactor plugin classes * Cleanup * Update * More cleanup * Cleanup register functions * Remove plugins file, use default coordination values from plugin objects * Comment * Use superRefine to check for deprecated coordination types * Revert * Fix tests * Extra imports * Try env.d.ts * Update * Update plugin examples * Linting for obsSets view * Comment * Allow ts in vite bundling config * Fix e2e tests * Update * Fix import * Allow empty props * Update * Remove ajv * Update * Update deps * Lint * Fix tests * Implement plugin classes with typescript * Add config uid property * use .length * Fix docs * Update plugin docs * Add config schema versioning docs * Add useCallback calls to obsSetsManager * Remove unnecessary fromEntries * Implement getSourceAndLoader function * Remove extra import * Eslint comment * Demo * Update dev-config-versioning.md * Update docusaurus.config.js * Lint * Make json schemas * Tsconfig * Lockfile * Update deploy script and readme * Simplify pnpm command * Update pnpm lock * Respond to PR feedback * Fix type issues, update docs * Refactor base plugins * Update * Pnpm install * Types in package.json * Fix tsconfig project references * Pnpm lock * Add dev-docs * Working types and linting * pnpm lock * Update * Fix test * Lint * Pnpm lock * React import * React import * More react imports * Update package.json exports in sub-packages, add new test for dynamic importmap * Add comment * Comment * Dev-docs * Add comment * Use dynamic-importmap * Try compressed-size-action * Update * Node options * env * Clean cmd * Use .js * Comments * Revert webpack plugin * Update cypress e2e tests * Add/move dev-docs * Update design-guidelines.md * Fix meta-updater * Revert config * Update design-guidelines.md * Update README.md * Update design-guidelines.md * Update design-guidelines.md * Update design-guidelines.md * Update rollup.config.js * Revert unrelated change * Revert unrelated github action change * WIP: clean up lodash, mui, uuid imports * More import fixes * De-duplicate imports * Dev-docs about js imports * Use publint * Fix typo * isEqual * Fix tests * Revert changed ObsSetsManager * Dev-docs * Dev-docs linked from main README * Demo * NextJS consumer test * NextJS consumer test * Changelog * README * Use .js extensions for imports to so that source is ESM (#1519) * Use .js * Comments * Revert webpack plugin * Update cypress e2e tests * Add/move dev-docs * Update design-guidelines.md * Fix meta-updater * Revert config * Update design-guidelines.md * Update README.md * Update design-guidelines.md * Update design-guidelines.md * Update design-guidelines.md * Update rollup.config.js * Revert unrelated change * WIP: clean up lodash, mui, uuid imports * More import fixes * De-duplicate imports * Dev-docs about js imports * Use publint * isEqual * Fix tests * Dev-docs * Dev-docs linked from main README * Demo * Feedback * Use same terminology in docs as code * Fix merge * Revert workspace change * Linting * Update Vis.js
Fixes #1374
Fixes #1515
Fixes #1520
(This is a PR into the Zod PR)
.js
endings during its compilation step, but the TypeScript developers seem very against that - it seems like the reasoning is to keep the scope of TS to only 1) performing type checking and 2) stripping types from the file. It is odd because TS does perform JSX->JS transformation, though perhaps the reasoning there is that it has a 1-to-1 mapping to the JS syntax while updating import statements could change the behavior?dev-docs
publint
to check package.jsontype: module
everywhereDemo of documentation: http://vitessce-data.s3-website-us-east-1.amazonaws.com/docs/2023-05-11/512964ad/docs/upgrade-guide/
Checklist
vitessce-python
andvitessce-r
if this is a release PR