Skip to content

Commit

Permalink
use cjs wrapper for esm default interop
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar committed Mar 6, 2024
1 parent e240f9e commit 1512890
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/vite/.babelrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/vite/build.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { build } from '@redwoodjs/framework-tools'

await build()
1 change: 1 addition & 0 deletions packages/vite/cjsWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./dist/index.js').default

Check failure on line 1 in packages/vite/cjsWrapper.js

View workflow job for this annotation

GitHub Actions / 🏗 Build, lint, test / ubuntu-latest / node 20 latest

'module' is not defined

Check failure on line 1 in packages/vite/cjsWrapper.js

View workflow job for this annotation

GitHub Actions / 🏗 Build, lint, test / ubuntu-latest / node 20 latest

'require' is not defined
9 changes: 5 additions & 4 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
"default": "./cjsWrapper.js"
},
"./entries": {
"types": "./dist/entries.d.ts",
Expand Down Expand Up @@ -57,11 +57,11 @@
},
"files": [
"dist",
"inject"
"inject",
"cjsWrapper.js"
],
"scripts": {
"build": "yarn build:js && yarn build:types",
"build:js": "babel src -d dist --extensions \".js,.jsx,.ts,.tsx\"",
"build": "tsx build.mts && yarn build:types",
"build:pack": "yarn pack -o redwoodjs-vite.tgz",
"build:types": "tsc --build --verbose",
"test": "vitest run src",
Expand Down Expand Up @@ -99,6 +99,7 @@
"@types/yargs-parser": "21.0.3",
"glob": "10.3.10",
"rollup": "3.29.4",
"tsx": "4.6.2",
"typescript": "5.3.3",
"vitest": "1.2.2"
},
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8767,6 +8767,7 @@ __metadata:
react: "npm:0.0.0-experimental-e5205658f-20230913"
react-server-dom-webpack: "npm:0.0.0-experimental-e5205658f-20230913"
rollup: "npm:3.29.4"
tsx: "npm:4.6.2"
typescript: "npm:5.3.3"
vite: "npm:4.5.2"
vitest: "npm:1.2.2"
Expand Down

0 comments on commit 1512890

Please sign in to comment.