loro/crates/loro-wasm/rollup.config.mjs
Zixuan Chen 62a3a93552
Refactor: merge two js packages (#532)
* feat: make vitest tests pass

* chore: update readme & add deno test for web bundle

* chore: bump version to 1.0.8-alpha.0

* chore: bump loro-crdt version

* fix: build script
export init method from loro-wasm/web

* chore: bump version

* chore: specify which files to include for npm publish

* refactor: rename loro-js to loro-js-test

* refactor: remove the old loro-js folder

* fix: build scripts

* chore: 1.0.8-alpha.3

* chore: add release info
2024-10-29 21:46:56 +08:00

38 lines
842 B
JavaScript

import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
const createConfig = (format, tsTarget, outputDir) => ({
input: {
'index': 'index.ts',
},
output: {
dir: outputDir,
format: format,
sourcemap: true,
entryFileNames: '[name].js',
},
plugins: [
typescript({
tsconfig: 'tsconfig.json',
compilerOptions: {
target: tsTarget,
declaration: true,
outDir: outputDir,
},
exclude: ['tests/**/*']
}),
nodeResolve()
],
external: [/loro_wasm/]
});
// Create different bundle configurations
export default [
// CommonJS for Node.js
createConfig('cjs', 'ES2020', 'nodejs'),
// ESM for Web
createConfig('es', 'ES2020', 'web'),
// ESM for bundler
createConfig('es', 'ES2020', 'bundler'),
];