Skip to content

Commit 70a9cf5

Browse files
authored
feat: Common-js output for @powersync/common (#644)
1 parent 71db1e7 commit 70a9cf5

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

.changeset/orange-turtles-beam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/common': patch
3+
---
4+
5+
Added CommonJs output for common package. Ensuring default export entry is last so that require statements don't use .mjs output instead of .cjs.

packages/common/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
"exports": {
1414
".": {
1515
"import": "./dist/bundle.mjs",
16-
"default": "./dist/bundle.mjs",
17-
"types": "./lib/index.d.ts"
16+
"require": "./dist/bundle.cjs",
17+
"types": "./lib/index.d.ts",
18+
"default": "./dist/bundle.mjs"
1819
}
1920
},
2021
"author": "JOURNEYAPPS",

packages/common/rollup.config.mjs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@ export default (commandLineArgs) => {
1515

1616
return {
1717
input: 'lib/index.js',
18-
output: {
19-
file: 'dist/bundle.mjs',
20-
format: 'esm',
21-
sourcemap: sourceMap
22-
},
18+
output: [
19+
{
20+
file: 'dist/bundle.mjs',
21+
format: 'esm',
22+
sourcemap: sourceMap
23+
},
24+
{
25+
file: 'dist/bundle.cjs',
26+
format: 'cjs',
27+
sourcemap: sourceMap
28+
}
29+
],
2330
plugins: [
2431
json(),
2532
nodeResolve({ preferBuiltins: false, browser: true }),

0 commit comments

Comments
 (0)