From 3b5ede2a47e8eb1175dedf84795e24c519eeef9a Mon Sep 17 00:00:00 2001 From: jdecroock Date: Mon, 6 Mar 2023 11:30:45 +0100 Subject: [PATCH 1/2] fix cjs export --- .changeset/clever-ghosts-grin.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/clever-ghosts-grin.md diff --git a/.changeset/clever-ghosts-grin.md b/.changeset/clever-ghosts-grin.md new file mode 100644 index 00000000..e4687055 --- /dev/null +++ b/.changeset/clever-ghosts-grin.md @@ -0,0 +1,5 @@ +--- +'preact-render-to-string': patch +--- + +Fix CJS export diff --git a/package.json b/package.json index a4393301..039832f1 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "bench:v8": "BABEL_ENV=test microbundle benchmarks/index.js -f modern --alias benchmarkjs-pretty=benchmarks/lib/benchmark-lite.js --external none --target node --no-compress --no-sourcemap --raw -o benchmarks/.v8.mjs && v8 --module benchmarks/.v8.mjs", "build": "npm run -s transpile && npm run -s transpile:jsx && npm run -s copy-typescript-definition", "postbuild": "node ./config/node-13-exports.js && node ./config/node-commonjs.js", - "transpile": "microbundle src/index.js -f es,umd --target web --external preact", + "transpile": "microbundle src/index.js -f es,cjs --target web --external preact", "transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external preact && microbundle dist/jsx.js -o dist/jsx.js -f cjs --external preact", "copy-typescript-definition": "copyfiles -f src/*.d.ts dist", "test": "eslint src test && tsc && npm run test:mocha && npm run test:mocha:compat && npm run test:mocha:debug && npm run bench", From de4154b441646527ed80bdefcd5d811395af9df3 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Sun, 19 Mar 2023 12:50:20 +0100 Subject: [PATCH 2/2] add back umd --- package.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 039832f1..00807dc4 100644 --- a/package.json +++ b/package.json @@ -4,21 +4,23 @@ "version": "5.2.6", "description": "Render JSX to an HTML string, with support for Preact components.", "main": "dist/index.js", - "umd:main": "dist/index.js", + "umd:main": "dist/index.umd.js", "module": "dist/index.module.js", "jsnext:main": "dist/index.module.js", "types": "src/index.d.ts", "exports": { ".": { "types": "./src/index.d.ts", - "import": "./dist/index.mjs", "browser": "./dist/index.module.js", + "umd": "./dist/index.umd.js", + "import": "./dist/index.mjs", "require": "./dist/index.js" }, "./jsx": { "types": "./jsx.d.ts", - "import": "./dist/jsx.mjs", "browser": "./dist/jsx.module.js", + "umd": "./dist/jsx.umd.js", + "import": "./dist/jsx.mjs", "require": "./dist/jsx.js" }, "./package.json": "./package.json" @@ -28,7 +30,7 @@ "bench:v8": "BABEL_ENV=test microbundle benchmarks/index.js -f modern --alias benchmarkjs-pretty=benchmarks/lib/benchmark-lite.js --external none --target node --no-compress --no-sourcemap --raw -o benchmarks/.v8.mjs && v8 --module benchmarks/.v8.mjs", "build": "npm run -s transpile && npm run -s transpile:jsx && npm run -s copy-typescript-definition", "postbuild": "node ./config/node-13-exports.js && node ./config/node-commonjs.js", - "transpile": "microbundle src/index.js -f es,cjs --target web --external preact", + "transpile": "microbundle src/index.js -f es,cjs,umd --target web --external preact", "transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external preact && microbundle dist/jsx.js -o dist/jsx.js -f cjs --external preact", "copy-typescript-definition": "copyfiles -f src/*.d.ts dist", "test": "eslint src test && tsc && npm run test:mocha && npm run test:mocha:compat && npm run test:mocha:debug && npm run bench",