Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix!: subpackage exports types #111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

userquin
Copy link

@userquin userquin commented Dec 18, 2024

This PR includes:

  • fixes subpackages exports, right now only proper types for bundler module resolutions (check screenshots below)
  • adss typesVersions to resolve types for subpackes exports other than default for node10 module resolution
  • includes .idea in .gitignore to exclude JetBrains IDE stuff (similar to .vscode folder)
  • adds files to package.json to include only dist folder, we don't need 800KB of source code, you've the repo here (from +800KB to 260KB only)
  • adds scripts/postbuild.mjs to add .js extension in dts files importing from dist folder and runs it in the build script

We can remove also the require entry in the default package exports since the build doesn't generate cjs files, the module using imports. Why do we need the ./dist/react-legacy/pwa-install.react-legacy.js in the package exports? This should be removed , importing from @khmyznikov/pwa-install/react-legacy should now work.

NOTE: you should check it before releasing it in some project to check if the changes in this PR works (I can check it using Vite in this repo https://github.com/sunflower-land/sunflower-land/blob/e42df72f13b17fd514e8953855c858ca79b464f4/src/features/pwa/PWAInstallProvider.tsx#L10).

Without this PR (https://arethetypeswrong.github.io/?p=%40khmyznikov%2Fpwa-install%400.4.8):

imagen

With this PR (run npm run build && npm pack in this PR and then upload the tgz file to https://arethetypeswrong.github.io/):

imagen

@userquin
Copy link
Author

Working using Vite: check sunflower-land/sunflower-land#4987 (expand Install working on my local on my android phone (via usb))

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant