Skip to content
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

Revert "Use ESM entrypoint for require(ESM)" #17156

Merged
merged 9 commits into from
Feb 22, 2025
Merged

Conversation

fisker
Copy link
Member

@fisker fisker commented Feb 19, 2025

Reverts #16958

Fixes #17139

@tats-u

Copy link

github-actions bot commented Feb 19, 2025

Size Change: -699 B (-0.01%)

Total Size: 7.89 MB

Filename Size Change
./dist/package.json 6.33 kB -699 B (-9.94%) 👏
ℹ️ View Unchanged
Filename Size
./dist/bin 4.1 kB
./dist/bin/prettier.cjs 2.24 kB
./dist/doc.d.ts 7.42 kB
./dist/doc.js 53.8 kB
./dist/doc.mjs 50.2 kB
./dist/index.cjs 36.9 kB
./dist/index.d.ts 27.1 kB
./dist/index.mjs 744 kB
./dist/internal 4.1 kB
./dist/internal/cli.mjs 146 kB
./dist/LICENSE 1.06 kB
./dist/plugins 4.1 kB
./dist/plugins/acorn.d.ts 109 B
./dist/plugins/acorn.js 152 kB
./dist/plugins/acorn.mjs 152 kB
./dist/plugins/angular.d.ts 177 B
./dist/plugins/angular.js 85.9 kB
./dist/plugins/angular.mjs 85.2 kB
./dist/plugins/babel.d.ts 419 B
./dist/plugins/babel.js 316 kB
./dist/plugins/babel.mjs 316 kB
./dist/plugins/estree.d.ts 11 B
./dist/plugins/estree.js 202 kB
./dist/plugins/estree.mjs 201 kB
./dist/plugins/flow.d.ts 90 B
./dist/plugins/flow.js 680 kB
./dist/plugins/flow.mjs 680 kB
./dist/plugins/glimmer.d.ts 93 B
./dist/plugins/glimmer.js 138 kB
./dist/plugins/glimmer.mjs 137 kB
./dist/plugins/graphql.d.ts 93 B
./dist/plugins/graphql.js 44.1 kB
./dist/plugins/graphql.mjs 43.4 kB
./dist/plugins/html.d.ts 139 B
./dist/plugins/html.js 152 kB
./dist/plugins/html.mjs 151 kB
./dist/plugins/markdown.d.ts 127 B
./dist/plugins/markdown.js 149 kB
./dist/plugins/markdown.mjs 149 kB
./dist/plugins/meriyah.d.ts 93 B
./dist/plugins/meriyah.js 132 kB
./dist/plugins/meriyah.mjs 131 kB
./dist/plugins/postcss.d.ts 121 B
./dist/plugins/postcss.js 154 kB
./dist/plugins/postcss.mjs 153 kB
./dist/plugins/typescript.d.ts 96 B
./dist/plugins/typescript.js 889 kB
./dist/plugins/typescript.mjs 888 kB
./dist/plugins/yaml.d.ts 90 B
./dist/plugins/yaml.js 122 kB
./dist/plugins/yaml.mjs 122 kB
./dist/README.md 3.94 kB
./dist/standalone.d.ts 1.36 kB
./dist/standalone.js 82.1 kB
./dist/standalone.mjs 81.9 kB
./dist/THIRD-PARTY-NOTICES.md 208 kB

compressed-size-action

Copy link

pkg-pr-new bot commented Feb 19, 2025

Open in Stackblitz

npm i https://pkg.pr.new/prettier@17156

commit: 27da981

@fisker fisker requested a review from sosukesuzuki February 19, 2025 16:25
@fisker fisker marked this pull request as ready for review February 19, 2025 16:29
@fisker
Copy link
Member Author

fisker commented Feb 20, 2025

As tested, this also fixes shufo/prettier-plugin-blade#311

@fisker
Copy link
Member Author

fisker commented Feb 20, 2025

I haven't got enough information from prettier/plugin-php#2418, but shufo/prettier-plugin-blade#311 products the same error.

@fisker
Copy link
Member Author

fisker commented Feb 22, 2025

I'm going to merge this and release a patch.

@fisker fisker merged commit bf5aab8 into main Feb 22, 2025
33 checks passed
@fisker fisker deleted the revert-16958-module-sync branch February 22, 2025 04:07
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Feb 22, 2025
| datasource | package  | from  | to    |
| ---------- | -------- | ----- | ----- |
| npm        | prettier | 3.5.1 | 3.5.2 |


## [v3.5.2](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#352)

[diff](prettier/prettier@3.5.1...3.5.2)

##### Remove `module-sync` condition ([#17156](prettier/prettier#17156) by [@fisker](https://github.com/fisker))

In Prettier 3.5.0, [we added `module-sync` condition to `package.json`](https://prettier.io/blog/2025/02/09/3.5.0#use-esm-entrypoint-for-requireesm-16958-by-tats-u), so that `require("prettier")` can use ESM version, but turns out it doesn't work if CommonJS and ESM plugins both imports builtin plugins. To solve this problem, we decide simply remove the `module-sync` condition, so `require("prettier")` will still use the CommonJS version, we'll revisit until `require(ESM)` feature is more stable.
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Feb 23, 2025
| datasource | package  | from  | to    |
| ---------- | -------- | ----- | ----- |
| npm        | prettier | 3.5.1 | 3.5.2 |


## [v3.5.2](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#352)

[diff](prettier/prettier@3.5.1...3.5.2)

##### Remove `module-sync` condition ([#17156](prettier/prettier#17156) by [@fisker](https://github.com/fisker))

In Prettier 3.5.0, [we added `module-sync` condition to `package.json`](https://prettier.io/blog/2025/02/09/3.5.0#use-esm-entrypoint-for-requireesm-16958-by-tats-u), so that `require("prettier")` can use ESM version, but turns out it doesn't work if CommonJS and ESM plugins both imports builtin plugins. To solve this problem, we decide simply remove the `module-sync` condition, so `require("prettier")` will still use the CommonJS version, we'll revisit until `require(ESM)` feature is more stable.
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Feb 26, 2025
| datasource | package  | from  | to    |
| ---------- | -------- | ----- | ----- |
| npm        | prettier | 3.5.1 | 3.5.2 |


## [v3.5.2](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#352)

[diff](prettier/prettier@3.5.1...3.5.2)

##### Remove `module-sync` condition ([#17156](prettier/prettier#17156) by [@fisker](https://github.com/fisker))

In Prettier 3.5.0, [we added `module-sync` condition to `package.json`](https://prettier.io/blog/2025/02/09/3.5.0#use-esm-entrypoint-for-requireesm-16958-by-tats-u), so that `require("prettier")` can use ESM version, but turns out it doesn't work if CommonJS and ESM plugins both imports builtin plugins. To solve this problem, we decide simply remove the `module-sync` condition, so `require("prettier")` will still use the CommonJS version, we'll revisit until `require(ESM)` feature is more stable.
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.

[error] Cannot read properties of undefined (reading 'async')
2 participants