diff --git a/.changeset/stupid-flies-yell.md b/.changeset/stupid-flies-yell.md new file mode 100644 index 000000000000..70e3f9ec61b1 --- /dev/null +++ b/.changeset/stupid-flies-yell.md @@ -0,0 +1,5 @@ +--- +'@data-client/react': patch +--- + +CommonJS build includes NextJS App Directive compatibility diff --git a/package.json b/package.json index fb219f1d0fd8..7935f2b16f49 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/react/rollup.config.js b/packages/react/rollup.config.js index 9b226aeb9033..493cc6f9dc33 100644 --- a/packages/react/rollup.config.js +++ b/packages/react/rollup.config.js @@ -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'; @@ -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"), ], }); }); diff --git a/yarn.lock b/yarn.lock index 9531eea11320..8a42cbe07d34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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: @@ -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" @@ -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