@drttix/drt-sdk 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@drttix/drt-sdk",
3
3
  "description": "DRT SDK",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/esm/index.d.ts",
@@ -78,6 +78,22 @@ async function main() {
78
78
  await fixFile(rootIndex);
79
79
 
80
80
  await walk(root);
81
+
82
+ // Mark the ESM output tree as a module package. The SDK root package
83
+ // stays `type: commonjs` so the CJS build continues to work, but the
84
+ // `exports.import` entry points into `dist/esm/*.js`. Without a nested
85
+ // package.json here, tools like Next treat those `.js` files as CJS and
86
+ // reject the ESM syntax.
87
+ const esmPackageJson = path.resolve(
88
+ process.cwd(),
89
+ 'dist/esm/package.json',
90
+ );
91
+ await fs.writeFile(
92
+ esmPackageJson,
93
+ `${JSON.stringify({ type: 'module' }, null, 2)}\n`,
94
+ 'utf8',
95
+ );
96
+
81
97
  console.log('Done.');
82
98
  } catch (err) {
83
99
  console.error(err);