Skip to content

Conversation

JackRobards
Copy link
Owner

@JackRobards JackRobards commented Jan 21, 2025

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 as format: "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)

@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2025

⚠️ No Changeset found

Latest commit: 5e53f31

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -1,4 +1,6 @@
const { copy, mkdirp, writeFile } = require("fs-extra");
Copy link
Owner Author

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" };
Copy link
Owner Author

@JackRobards JackRobards Jan 21, 2025

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.

@JackRobards JackRobards force-pushed the switch-to-esm branch 2 times, most recently from e8b0189 to 054f1f3 Compare January 21, 2025 05:50
@JackRobards JackRobards changed the title Migrate lit-analyzer to ESM WIP: Migrate lit-analyzer to ESM Jan 21, 2025
@JackRobards JackRobards marked this pull request as draft January 21, 2025 08:28
@JackRobards JackRobards force-pushed the switch-to-esm branch 4 times, most recently from 1803b7f to 570e339 Compare January 22, 2025 04:39
@JackRobards JackRobards changed the title WIP: Migrate lit-analyzer to ESM Blocked: Migrate lit-analyzer packages to ESM Jan 22, 2025
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.

1 participant