Skip to content

Conversation

@jessecollier
Copy link
Contributor

Summary & Motivation

Previously using a tsconfig.esm.json would compile output for esm, however paths were relative with no extensions.

Typically this is solved by using fully specified extensions in imports in TS files. However, this will not work in a dual output module (cjs and esm).

To resolve this, rollup is used to compile and export both cjs and esm as well as types.

Additionally, by default rollup will bundle everything into one file. To preserve file structure, this is disabled.

Additionally, without specifiying type: module in the package json all ES modules need the mjs extension to be interpreted by downstream compilers as ES modules.

How I Tested These Changes

Did you add a changeset?

To add a changeset for your pr run pnpm changeset. pnpm changest will generate a file where you should write a human friendly message about the changes. Note how this (example) includes the package name (should be auto added by the command) along with the type of semver change (major.minor.patch) (which you should set).

These changes will be used at release time to determine what packages to publish and how to bump their version. For more context see this comment.

@socket-security
Copy link

New dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
rollup 4.5.2 eval, filesystem, environment +0 2.16 MB lukastaegert

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 27, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@r-n-o r-n-o mentioned this pull request Nov 27, 2023
Copy link
Contributor

@r-n-o r-n-o left a comment

Choose a reason for hiding this comment

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

Awesome!

@r-n-o r-n-o merged commit 455a1c6 into main Nov 27, 2023
@r-n-o r-n-o deleted the jesse/add-rollup branch November 27, 2023 21:57
r-n-o added a commit that referenced this pull request Nov 27, 2023
r-n-o added a commit that referenced this pull request Nov 27, 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.

3 participants