Skip to content

Commit

Permalink
enhance: Improve compatibility by forcing app directive in commonjs b…
Browse files Browse the repository at this point in the history
…uild (#2825)
  • Loading branch information
ntucker authored Sep 21, 2023
1 parent a0953e5 commit f5ac286
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/stupid-flies-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@data-client/react': patch
---

CommonJS build includes NextJS App Directive compatibility
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"rimraf": "^5.0.0",
"rollup": "2.79.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-banner2": "^1.2.2",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-dts": "^5.0.0",
"rollup-plugin-filesize": "^9.1.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/react/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import babel from 'rollup-plugin-babel';
import banner from 'rollup-plugin-banner2';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
import json from 'rollup-plugin-json';
Expand Down Expand Up @@ -76,6 +77,8 @@ if (process.env.BROWSERSLIST_ENV !== 'node12') {
replace({ 'process.env.CJS': 'true' }),
resolve({ extensions: nativeExtensions }),
commonjs({ extensions: nativeExtensions }),
// for nextjs 13 compatibility in node https://nextjs.org/docs/app/building-your-application/rendering
banner(() => "'use client';\n"),
],
});
});
Expand Down
12 changes: 11 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18438,7 +18438,7 @@ __metadata:
languageName: node
linkType: hard

"magic-string@npm:^0.25.1, magic-string@npm:^0.25.2":
"magic-string@npm:^0.25.1, magic-string@npm:^0.25.2, magic-string@npm:^0.25.7":
version: 0.25.9
resolution: "magic-string@npm:0.25.9"
dependencies:
Expand Down Expand Up @@ -25684,6 +25684,15 @@ __metadata:
languageName: node
linkType: hard

"rollup-plugin-banner2@npm:^1.2.2":
version: 1.2.2
resolution: "rollup-plugin-banner2@npm:1.2.2"
dependencies:
magic-string: ^0.25.7
checksum: 6647602b31d35d5f925920254e70fa9f0d272fda2a3eae0a749a500f32c78ce82f3f48200c5b6cc0f983fe412471b749b53333d87f9e430bd8b2a95637648347
languageName: node
linkType: hard

"rollup-plugin-commonjs@npm:^10.1.0":
version: 10.1.0
resolution: "rollup-plugin-commonjs@npm:10.1.0"
Expand Down Expand Up @@ -25872,6 +25881,7 @@ __metadata:
rimraf: ^5.0.0
rollup: 2.79.1
rollup-plugin-babel: ^4.4.0
rollup-plugin-banner2: ^1.2.2
rollup-plugin-commonjs: ^10.1.0
rollup-plugin-dts: ^5.0.0
rollup-plugin-filesize: ^9.1.2
Expand Down

0 comments on commit f5ac286

Please sign in to comment.