-
Notifications
You must be signed in to change notification settings - Fork 75
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
Migrating to ECMAScript modules #894
Conversation
# Conflicts: # package-lock.json
# Conflicts: # package-lock.json
# Conflicts: # package-lock.json # package.json
Hey @Janther, I won't have time to review this but I did try it locally with both Prettier v2 and v3 (using verdaccio, which I recommend for scenarios like this one). Prettier v3 works fine, but v2 doesn't because the In any case, I'm pre-approving it. |
"dist/standalone.js", | ||
"dist/standalone.js.LICENSE.txt", | ||
"dist/standalone.js.map", | ||
"dist/**/*", |
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.
My bad. I'll push a commit making sure webpack
cleans the folder before building to avoid publishing random stuff
I know this PR looks very daunting.
Here are the main changes:
elsint
,jest
, andwebpack
configurations were changed accordinglydist/standalone.cjs
instead ofdist/standalone.js
require
were switched toimport
module.exports
were switched toexport default
orexport
individual functions__dirname
were changed tometa.import
and then extracted from that valuedoc
that was changed todocument
since now theimport
exposesprettier.doc
directlygenerateindexes
script had to be removed sincedir-to-object
doesn't supportesm
prettier
made to their tests when they migratedcommonjs
environment and normal tests use anesm
environment so we needesmock
orproxyquire
depending on the situationCaveats:
prettier 2
or acommonjs
development environment, then you have to use the compiled version of the plugindist/standalone.cjs
(this is done automatically by node and conditional exports), unit tests forprettier 2
had to be disabled for this reason