Skip to content

Commit 6cfeb2b

Browse files
authored
include .cjs and .mjs files in build output - issue #88 (#89)
* include .cjs and .mjs files in build output
1 parent de11102 commit 6cfeb2b

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.github/workflows/publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ jobs:
2929
run: npm ci
3030

3131
- name: "Build"
32-
run: npm run build
32+
run: |
33+
npm run build
34+
cp dist/react-to-webcomponent.es.js dist/react-to-webcomponent.mjs
35+
cp dist/react-to-webcomponent.cjs.js dist/react-to-webcomponent.cjs
3336
3437
- name: "Test"
3538
run: npm run buildtests && npm run test

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"name": "react-to-webcomponent",
33
"version": "1.7.4",
44
"description": "Convert react components to native Web Components.",
5-
"main": "./dist/react-to-webcomponent.es.js",
6-
"module": "./dist/react-to-webcomponent.es.js",
5+
"main": "./dist/react-to-webcomponent.cjs",
6+
"module": "./dist/react-to-webcomponent.mjs",
77
"types": "./dist/react-to-webcomponent.d.ts",
88
"exports": {
99
".": {
10-
"import": "./dist/react-to-webcomponent.es.js",
11-
"require": "./dist/react-to-webcomponent.umd.js"
10+
"import": "./dist/react-to-webcomponent.mjs",
11+
"require": "./dist/react-to-webcomponent.cjs"
1212
}
1313
},
1414
"files": [
@@ -51,7 +51,7 @@
5151
"keywords": [
5252
"React",
5353
"Preact",
54-
"WebComponents"
54+
"Web Component"
5555
],
5656
"author": "Bitovi",
5757
"license": "MIT",

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default defineConfig((configEnv) => ({
66
plugins: [typescript()],
77
build: {
88
lib: {
9-
formats: ["es", "umd"],
9+
formats: ["es", "umd", "cjs"],
1010
entry: resolve(__dirname, "src/react-to-webcomponent.js"),
1111
name: "react-to-webcomponent",
1212
fileName: (format) => `react-to-webcomponent.${format}.js`,

0 commit comments

Comments
 (0)