Skip to content

Distribute package as ESM#10

Merged
shamsmosowi merged 3 commits intorowyio:developfrom
il3ven:issue-1275
Jun 9, 2023
Merged

Distribute package as ESM#10
shamsmosowi merged 3 commits intorowyio:developfrom
il3ven:issue-1275

Conversation

@il3ven
Copy link
Member

@il3ven il3ven commented Jun 6, 2023

I am trying to migrate rowy from CRA to Vite and facing a problem due to this package. Currently this package tries to export both CJS and ESM but exports only CJS. Inside the CJS export, the package is using require to import lodash-es which is an ESM module. This is causing an error when building the project with Vite.

A solution will be to use resolve.alias to map lodash-es to lodash. This will not only map imports of form-builder but rowy too. Since, rowy is to be built using Vite and Vite uses ES modules we want to use lodash-es in rowy and not lodash.

My proposal is to make this package export as an ES module and then we won't have to map lodash-es.


I have updated use-debounce because they implemented a fix for ES modules. I have updated react-hook-form so that the react-hook-form of form-builder and rowy are same. I was getting a typescript error in rowy without it.


I have tested this PR along with rowio/rowy#1279

@shamsmosowi shamsmosowi changed the base branch from main to develop June 9, 2023 14:07
@shamsmosowi shamsmosowi merged commit a352d36 into rowyio:develop Jun 9, 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.

2 participants