Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

fix: map exports to dist folder #123

Merged
merged 1 commit into from
Nov 19, 2024
Merged

Conversation

amoshydra
Copy link
Contributor

@amoshydra amoshydra commented Nov 17, 2024

Summary

Update exports map to refer to files from dist folder

Reference taken for this exports map:

Related resources:

Related issue

Resolve #119

Previously, exports reference to the non-transpiled typescript files in src.
This is generally undesirable as consumer may not be using Typescript.

In certain case (i.e. #119 in vite) it causes the bundler to transpile the code instead of using the already transpiled mjs, cjs files.

How is this tested?

Attempted with the reproduce steps from #119.

Manually changing the export map in ./decimal128-tsc-issue/node_modules/decimal128/package.json shows successful build.

image

(1)

npm create vite@latest decimal128-tsc-issue -- --template react-ts
cd decimal128-tsc-issue
npm install
npm install --save decimal128
echo "import { Decimal128 } from 'decimal128'" > .\src\App.tsx
echo "export default () => new Decimal128(123).toString()" >> .\src\App.tsx

(2)
Apply this change inside ./decimal128-tsc-issue/node_modules/decimal128/package.json

(3)

npm run build

@jessealama jessealama merged commit 094a0f7 into jessealama:main Nov 19, 2024
@jessealama
Copy link
Owner

lgtm, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

decimal128 does not play nicely with tsc
2 participants