-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Bring back ESM build (and fix bundle size) #381
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import Middleware from './dist/middleware'; | ||
import createMiddleware from './dist/middleware'; | ||
|
||
export = Middleware; | ||
export = createMiddleware; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,26 +18,39 @@ | |
"postpublish": "git checkout . && rm ./README.md" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"typings": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"react-server": { | ||
"node": "./dist/react-server/index.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's important that this goes first, so it has priority over We're not 100% ESM-compatible: https://nodejs.org/api/esm.html#esm_mandatory_file_extensions But we don't want to be ESM-compatible anyway, because Next.js itself isn't, therefore the bundler will crash when it encounters imports from Next.js. Rather, we want to stay in CJS land for Node.js and only use |
||
"import": "./dist/react-server/index.mjs", | ||
"default": "./dist/react-server/index.js" | ||
}, | ||
"node": "./dist/index.js", | ||
"import": "./dist/index.mjs", | ||
"default": "./dist/index.js" | ||
}, | ||
"./server": { | ||
"node": "./dist/server/index.js", | ||
"import": "./dist/server/index.mjs", | ||
"default": "./dist/server/index.js" | ||
}, | ||
"./client": { | ||
"node": "./dist/client/index.js", | ||
"import": "./dist/client/index.mjs", | ||
"default": "./dist/client/index.js" | ||
}, | ||
"./link": { | ||
"types": "./link.d.ts", | ||
"node": "./dist/link/index.js", | ||
"import": "./dist/link/index.mjs", | ||
"default": "./dist/link/index.js" | ||
}, | ||
"./middleware": { | ||
"types": "./middleware.d.ts", | ||
"node": "./dist/middleware/index.js", | ||
"import": "./dist/middleware/index.mjs", | ||
"default": "./dist/middleware/index.js" | ||
} | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not used by Node.js, only by ESM-enabled bundlers.