-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Restructure package files, add exports
#13530
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
exports to package.jsonexports
| const PRETTIER_DIR = IS_PULL_REQUEST | ||
| ? DIST_DIR | ||
| : path.dirname(require.resolve("prettier")); | ||
| : url.fileURLToPath(new URL("../node_modules/prettier", import.meta.url)); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
Problem is not about resolve, require.resolve resolves to dev version, don't know why. But it will resolve to stable version if I remove exports.
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.
I got it.
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.
Co-authored-by: Sosuke Suzuki <[email protected]>
Co-authored-by: Sosuke Suzuki <[email protected]>
Description
exportsfor developmentpackage.json{ ".": { "require": "./src/index.cjs", "default": "./src/index.js" }, "./*": "./" }exportsfor productionpackage.json{ ".": { "require": "./index.cjs", "default": "./index.mjs" }, "./*": "./", "./doc": { "require": "./doc.js", "default": "./doc.mjs" }, "./standalone": { "require": "./standalone.js", "default": "./standalone.mjs" }, "./plugins/babel": { "require": "./plugins/babel.js", "default": "./plugins/babel.mjs" }, "./plugins/flow": { "require": "./plugins/flow.js", "default": "./plugins/flow.mjs" }, "./plugins/typescript": { "require": "./plugins/typescript.js", "default": "./plugins/typescript.mjs" }, "./plugins/acorn-and-espree": { "require": "./plugins/acorn-and-espree.js", "default": "./plugins/acorn-and-espree.mjs" }, "./plugins/meriyah": { "require": "./plugins/meriyah.js", "default": "./plugins/meriyah.mjs" }, "./plugins/angular": { "require": "./plugins/angular.js", "default": "./plugins/angular.mjs" }, "./plugins/postcss": { "require": "./plugins/postcss.js", "default": "./plugins/postcss.mjs" }, "./plugins/graphql": { "require": "./plugins/graphql.js", "default": "./plugins/graphql.mjs" }, "./plugins/markdown": { "require": "./plugins/markdown.js", "default": "./plugins/markdown.mjs" }, "./plugins/glimmer": { "require": "./plugins/glimmer.js", "default": "./plugins/glimmer.mjs" }, "./plugins/html": { "require": "./plugins/html.js", "default": "./plugins/html.mjs" }, "./plugins/yaml": { "require": "./plugins/yaml.js", "default": "./plugins/yaml.mjs" }, // legacy entries "./esm/standalone.mjs": "./standalone.mjs", "./parser-babel": "./plugins/babel.js", "./parser-babel.js": "./plugins/babel.js", "./esm/parser-babel.mjs": "./plugins/babel.mjs", "./parser-flow": "./plugins/flow.js", "./parser-flow.js": "./plugins/flow.js", "./esm/parser-flow.mjs": "./plugins/flow.mjs", "./parser-typescript": "./plugins/typescript.js", "./parser-typescript.js": "./plugins/typescript.js", "./esm/parser-typescript.mjs": "./plugins/typescript.mjs", "./parser-espree": "./plugins/acorn-and-espree.js", "./parser-espree.js": "./plugins/acorn-and-espree.js", "./esm/parser-espree.mjs": "./plugins/acorn-and-espree.mjs", "./parser-meriyah": "./plugins/meriyah.js", "./parser-meriyah.js": "./plugins/meriyah.js", "./esm/parser-meriyah.mjs": "./plugins/meriyah.mjs", "./parser-angular": "./plugins/angular.js", "./parser-angular.js": "./plugins/angular.js", "./esm/parser-angular.mjs": "./plugins/angular.mjs", "./parser-postcss": "./plugins/postcss.js", "./parser-postcss.js": "./plugins/postcss.js", "./esm/parser-postcss.mjs": "./plugins/postcss.mjs", "./parser-graphql": "./plugins/graphql.js", "./parser-graphql.js": "./plugins/graphql.js", "./esm/parser-graphql.mjs": "./plugins/graphql.mjs", "./parser-markdown": "./plugins/markdown.js", "./parser-markdown.js": "./plugins/markdown.js", "./esm/parser-markdown.mjs": "./plugins/markdown.mjs", "./parser-glimmer": "./plugins/glimmer.js", "./parser-glimmer.js": "./plugins/glimmer.js", "./esm/parser-glimmer.mjs": "./plugins/glimmer.mjs", "./parser-html": "./plugins/html.js", "./parser-html.js": "./plugins/html.js", "./esm/parser-html.mjs": "./plugins/html.mjs", "./parser-yaml": "./plugins/yaml.js", "./parser-yaml.js": "./plugins/yaml.js", "./esm/parser-yaml.mjs": "./plugins/yaml.mjs" }Make sense?
Fixes #8772
Checklist
docs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.✨Try the playground for this PR✨