diff --git a/.gitignore b/.gitignore index fe243e8b..f972b2a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ node_modules lib dist -cjs *.tsbuildinfo .vscode .DS_STORE diff --git a/packages/common/package.json b/packages/common/package.json index 6ec34ce5..8647d4ec 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -7,13 +7,12 @@ }, "description": "API definitions for JourneyApps PowerSync", "type": "module", - "main": "dist/bundle.cjs", + "main": "dist/bundle.mjs", "module": "dist/bundle.mjs", "types": "lib/index.d.ts", "exports": { ".": { "import": "./dist/bundle.mjs", - "require": "./dist/bundle.cjs", "default": "./dist/bundle.mjs", "types": "./lib/index.d.ts" } @@ -33,7 +32,7 @@ }, "homepage": "https://docs.powersync.com", "scripts": { - "build": "tsc -b && rollup -c rollup.config.mjs && rollup -c rollup-cjs.config.mjs", + "build": "tsc -b && rollup -c rollup.config.mjs", "clean": "rm -rf lib dist tsconfig.tsbuildinfo", "test": "vitest" }, diff --git a/packages/common/rollup-cjs.config.mjs b/packages/common/rollup-cjs.config.mjs deleted file mode 100644 index 36a5d559..00000000 --- a/packages/common/rollup-cjs.config.mjs +++ /dev/null @@ -1,41 +0,0 @@ -import commonjs from '@rollup/plugin-commonjs'; -import inject from '@rollup/plugin-inject'; -import json from '@rollup/plugin-json'; -import nodeResolve from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; - -export default (commandLineArgs) => { - const sourcemap = (commandLineArgs.sourceMap || 'true') == 'true'; - - // Clears rollup CLI warning https://github.com/rollup/rollup/issues/2694 - delete commandLineArgs.sourceMap; - - return { - // esm input is better, even for cjs output - input: 'lib/index.js', - output: { - file: 'dist/bundle.cjs', - format: 'cjs', - sourcemap: sourcemap - }, - plugins: [ - json(), - nodeResolve({ preferBuiltins: false, browser: true }), - commonjs({}), - inject({ - Buffer: ['buffer', 'Buffer'], - ReadableStream: ['web-streams-polyfill/ponyfill', 'ReadableStream'], - // Used by can-ndjson-stream - TextDecoder: ['text-encoding', 'TextDecoder'] - }), - terser() - ], - // This makes life easier - external: [ - // This has dynamic logic - makes bundling hard - 'cross-fetch', - // TODO: make the useDefaults logic better. Currently need access to this package directly - 'js-logger' - ] - }; -};