Skip to content

Commit

Permalink
cjs support for library
Browse files Browse the repository at this point in the history
  • Loading branch information
artursapek committed Mar 4, 2024
1 parent cd20d5f commit 888eaaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions wormhole-connect/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "@wormhole-foundation/wormhole-connect",
"version": "0.0.1-beta.0",
"main": "build/main.js",
"main": "lib/main.js",
"module": "lib/main.mjs",
"exports": {
".": "lib/index.js"
".": {
"require": "lib/index.js",
"import": "lib/index.mjs"
}
},
"files": [
"lib",
Expand Down
5 changes: 3 additions & 2 deletions wormhole-connect/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ const plugins = [
];

let output = {
entryFileNames: '[name].js',
assetFileNames: '[name]-[hash][extname]',
inlineDynamicImports: false,
exports: 'named',
};

let external = [
Expand Down Expand Up @@ -120,7 +120,8 @@ export default defineConfig(({ command, mode }) => {
outDir: './lib',
lib: {
entry: path.resolve(__dirname, 'src/index.tsx'),
formats: ['es'],
formats: ['es', 'cjs'],
fileName: 'index',
},
rollupOptions: {
input: {
Expand Down

0 comments on commit 888eaaf

Please sign in to comment.