diff --git a/CHANGELOG.md b/CHANGELOG.md index cf47b7b813e2..46c1f3257db5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ # CHANGELOG +## Unreleased + +- fix(esm): use CJS wrapper for ESM default interop (#10119) + + This PR builds on the work started in https://github.com/redwoodjs/redwood/pull/10083 around ESM. One of the caveats of that PR was that the default export from `@redwoodjs/vite` broke. The workaround was referencing the `default` property on the Redwood Vite plugin, like `redwood.default()`. This fixes the ES module default export interoperability so that no change is necessary in switching between module types. + - feature: Enable [CSS nesting](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_nesting/Using_CSS_nesting) syntax by default when using Tailwind: - + ``` .button { @apply p-2 font-semibold bg-gray-500; @@ -17,8 +23,6 @@ } ``` -## Unreleased - ## v7.1.0 - See https://github.com/redwoodjs/redwood/releases/tag/v7.1.0 diff --git a/packages/vite/cjsWrapper.js b/packages/vite/cjsWrapper.js new file mode 100644 index 000000000000..c73b42a1198c --- /dev/null +++ b/packages/vite/cjsWrapper.js @@ -0,0 +1,3 @@ +/* eslint-env node */ + +module.exports = require('./dist/index.js').default diff --git a/packages/vite/package.json b/packages/vite/package.json index 0b1f4e6a1b3a..20cca5618294 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -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", @@ -53,7 +53,8 @@ }, "files": [ "dist", - "inject" + "inject", + "cjsWrapper.js" ], "scripts": { "build": "yarn build:js && yarn build:types",