-
Notifications
You must be signed in to change notification settings - Fork 3
Blocked: Migrate lit-analyzer packages to ESM #117
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
base: main
Are you sure you want to change the base?
Conversation
|
@@ -1,4 +1,6 @@ | |||
const { copy, mkdirp, writeFile } = require("fs-extra"); |
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.
writeFile
is not actually an exported function of fs-extra
with the esm import:
https://github.com/jprichardson/node-fs-extra/tree/master
So these have been switched to outputFile
, which is mostly equivalent to that function.
@@ -1,4 +1,6 @@ | |||
const { copy, mkdirp, writeFile } = require("fs-extra"); | |||
import pluginPackageJson from "./package.json" with { type: "json" }; | |||
import tsPluginPackageJson from "../ts-lit-plugin/package.json" with { type: "json" }; |
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.
Ideally this would not be importing across package boundaries, but these packages do that in a few places currently and fixing it is outside of what I am trying to do on this PR.
e8b0189
to
054f1f3
Compare
fc04576
to
077f802
Compare
1803b7f
to
570e339
Compare
570e339
to
929c8dd
Compare
929c8dd
to
5e53f31
Compare
Setting as Blocked for now. I don't believe pure ESM is possible until VSCode extensions fully support ESM.
We could consider making the packages export both ESM and CJS (like
web-component-analyzer
already does), but that does not seem worth the effort to me at this time. If you'd like to see that feature added, then bring it up in the linked issue:#121
Notes
web-component-analyzer
is left mostly alone, and is still not solely ESM. It is configured to output both ESM and CJS, and has a slightly more complicated setup because of that. May be worth considering making ESM the default for the package at some point in the future, but otherwise I think it seems mostly fine as-is!vscode-lit-plugin
still is outputted asformat: "cjs"
in it's esbuild script. From what I can tell, VSCode extensions still do not fully support ESM so I've left this alone for now: Enable consuming of ES modules in extensions microsoft/vscode#130367. There are also difficulties getting the mocha VSCode tests to run correctly when the output is ESM (I saw some examples of how to get this working with ts-node/esm, but ran into some issues setting this up myself)