Skip to content

Add missing "type": "module" to package.json for Vite resolution #32

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

Closed
4 tasks done
jorenbroekema opened this issue Jun 28, 2022 · 3 comments
Closed
4 tasks done
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on

Comments

@jorenbroekema
Copy link

Initial checklist

Affected packages and versions

latest

Link to runnable example

No response

Steps to reproduce

  • import { toHtml } from 'hast-util-to-html' in a JS file
  • Run with Vite (e.g. dev server)

image

Expected behavior

Some developer tools assume any module is a CommonJS module unless "type":"module" is specified in package.json.
I don't particularly agree with that approach and I'm not sure why the Vite maintainers decided to be more "dumb" about it in their resolution logic versus what they had before, but it seems to me that providing this meta information doesn't hurt and helps tools understand more clearly what format a module is.

Expected: "type": "module" in package.json

Actual behavior

Missing "type": "module" in package.json, results in tools thinking the module is CommonJS format.

Affected runtime and version

[email protected]

Affected package manager and version

[email protected]

Affected OS and version

No response

Build and bundle tools

Vite

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jun 28, 2022
@wooorm
Copy link
Member

wooorm commented Jun 28, 2022

"type": "module",

Update your dependencies and built tools

@wooorm wooorm closed this as completed Jun 28, 2022
@wooorm wooorm added 🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on labels Jun 28, 2022
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Jun 28, 2022
@jorenbroekema
Copy link
Author

Ah sorry, I read over it completely. 👍

@wooorm
Copy link
Member

wooorm commented Jun 28, 2022

no problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙅 no/wontfix This is not (enough of) an issue for this project 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants