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

fix: Minor tsconfig fixes and packaging improvements. #9

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dhess
Copy link
Contributor

@dhess dhess commented Jan 29, 2023

No description provided.

Specifically:

* This file is used for typechecking the entire project (as opposed to
just the library portion, which is checked via a different tsconfig
file), and generates no type declarations, so set `noEmit` to
true (and remove command-line flag from script).

* Remove `outDir`, since nothing is emitted when using this config.

* Set `jsx` to "react-jsx" per recent versions of React.
Specifically:

* Remove UMD module support. Per caniuse.com, all browsers that
support WebAssembly also support ES6, save Firefox < 54, which is now
over 5 years old.

* Add `files` to the package config and ensure that all files in
`dist` and `wasm_dist` are included in the package.

Note that Storybook expects CommonJS format, and adding `type: module`
to `package.json` causes it to break. This will be fixed in Storybook
v7, but until then, we implement the workaround described here:

storybookjs/storybook#11587 (comment)
Move common settings into a base config, then extend it as follows:

* Whole-project typecheck-only config which emits nothing.

* Typecheck-only config for just the library (no Storybook, etc.),
which emits only type declarations.

Additionally, we make the following changes to all configs:

* Remove `downlevelIteration` setting as we're not using TypeScript to
emit code, only types.

* Remove `lib` setting, as it's redundant: "DOM" is included by
default, and the appropriate module types are included according to
the `target` setting.

* Target ES6, which should work on all browsers which have Wasm
support, and is sufficient for this module's needs.

* Remove ES2018 targets, which are unnecessary for this module.
@dhess dhess marked this pull request as draft February 3, 2023 11:22
@dhess
Copy link
Contributor Author

dhess commented Feb 3, 2023

This has been working for us in our fork for awhile, but a recent update to Vite seems to have issues with dropping the CommonJS module support. I'm looking into it, but I've marked this as a draft until I can get to the bottom of the issue.

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.

1 participant