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: fix CJS compatibility #2605

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Conversation

wojtekmaj
Copy link
Contributor

@wojtekmaj wojtekmaj commented Feb 6, 2024

Closes #2602
Closes #2603

Sorry about that!

We will also need some sanity checks to prevent this from happening in the future.

Copy link

changeset-bot bot commented Feb 6, 2024

🦋 Changeset detected

Latest commit: 3b82248

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@react-pdf/stylesheet Patch
@react-pdf/renderer Patch
@react-pdf/textkit Patch
@react-pdf/layout Patch
@react-pdf/png-js Patch
@react-pdf/render Patch
@react-pdf/image Patch
@react-pdf/font Patch
@react-pdf/fns Patch
@react-pdf/examples Patch
@react-pdf/pdfkit Patch
@react-pdf/svgkit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wojtekmaj
Copy link
Contributor Author

Before:

wmaj@MacBook-Air layout % yarn build && node lib/index.cjs
yarn run v1.22.19
$ rimraf ./lib && rollup -c
(node:69215) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:69215) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time

src/index.js → lib/index.js, lib/index.cjs...
created lib/index.js, lib/index.cjs in 1.2s
✨  Done in 1.88s.
/Users/wmaj/Projekty/Open source projects/diegomura-react-pdf/packages/layout/lib/index.cjs:308
var engine$1 = layoutEngine(engines$1);
               ^

TypeError: layoutEngine is not a function
    at Object.<anonymous> (/Users/wmaj/Projekty/Open source projects/diegomura-react-pdf/packages/layout/lib/index.cjs:308:16)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v20.9.0

After:

wmaj@MacBook-Air layout % yarn build && node lib/index.cjs
yarn run v1.22.19
$ rimraf ./lib && rollup -c
(node:69580) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:69580) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time

src/index.js → lib/index.js, lib/index.cjs...
created lib/index.js, lib/index.cjs in 923ms
✨  Done in 1.31s.

Copy link
Owner

@diegomura diegomura left a comment

Choose a reason for hiding this comment

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

utACK

Thanks!

@diegomura diegomura merged commit f7505ed into diegomura:master Feb 6, 2024
7 checks passed
@github-actions github-actions bot mentioned this pull request Feb 6, 2024
@wojtekmaj wojtekmaj deleted the wmaj/compat branch February 6, 2024 18:55
mskec pushed a commit to mskec/react-pdf that referenced this pull request Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants