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

Add support for TypeScript moduleResolution - bundler #458

Merged
merged 1 commit into from
Apr 7, 2023
Merged

Add support for TypeScript moduleResolution - bundler #458

merged 1 commit into from
Apr 7, 2023

Conversation

xeho91
Copy link
Contributor

@xeho91 xeho91 commented Apr 4, 2023

What's the purpose of this package?

Let me start with - why.

While developing my package, I am using TypeScript version v5.0.
The build compilation were failing because of the following error:

src/cli.ts(5,27): error TS7016: Could not find a declaration file for module 'lightningcss'. '/home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/lightningcss@1.19.0/node_modules/
lightningcss/node/index.mjs' implicitly has an 'any' type.
  There are types at '/home/xeho91/Nextcloud/Projects/oss/typewind/packages/typewind/node_modules/lightningcss/node/index.d.ts', but this result could not be resolved when respecting package.
json "exports". The 'lightningcss' library may need to update its package.json or typings.

Error: error occured in dts build
    at Worker.<anonymous> (/home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/tsup@6.7.0_postcss@8.4.21_typescript@5.0.3/node_modules/tsup/dist/index.js:2281:26)
    at Worker.emit (node:events:513:28)
    at MessagePort.<anonymous> (node:internal/worker:233:53)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)
DTS Build error
RollupError: Failed to compile. Check the logs above.
    at error (/home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/shared/rollup.js:274:30)
    at Object.error (/home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/shared/rollup.js:24694:20)
    at Object.error (/home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/shared/rollup.js:23888:42)
    at generateDtsFromTs (/home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/tsup@6.7.0_postcss@8.4.21_typescript@5.0.3/node_modules/tsup/dist/rollup.js:7498:22)
    at /home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/tsup@6.7.0_postcss@8.4.21_typescript@5.0.3/node_modules/tsup/dist/rollup.js:7505:59
    at _nullishCoalesce (/home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/tsup@6.7.0_postcss@8.4.21_typescript@5.0.3/node_modules/tsup/dist/rollup.js:1:198)
    at Object.transform (/home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/tsup@6.7.0_postcss@8.4.21_typescript@5.0.3/node_modules/tsup/dist/rollup.js:7505:18)
    at /home/xeho91/Nextcloud/Projects/oss/typewind/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/shared/rollup.js:24893:40
 ELIFECYCLE  Command failed with exit code 1.

So, I cloned your reposiory, and I have used the tool publint, to see what's wrong.

There was a warning:

$ pnpm publint .
lightningcss lint results:
Warnings:
1. The library has types at node/index.d.ts but it is not exported from pkg.exports.
Consider adding it to pkg.exports.types to be compatible with TypeScript's "moduleResolution": "bundler" compiler option.

This is the reason of this Pull Request, a simple, one-line fix in package.json file.

@mischnic mischnic linked an issue Apr 4, 2023 that may be closed by this pull request
Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@devongovett devongovett merged commit 2dbca6f into parcel-bundler:master Apr 7, 2023
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.

Add types in package.json exports
2 participants