Skip to content
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: export CJS version for browser #43

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/afraid-coats-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@remix-run/web-blob": patch
"@remix-run/web-fetch": patch
"@remix-run/web-file": patch
"@remix-run/web-form-data": patch
"@remix-run/web-stream": patch
brophdawg11 marked this conversation as resolved.
Show resolved Hide resolved
---

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a minor since it's sort of adding a new feature in CJS files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with patch as it not a real feature, but I can go with minor if you want

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok - yeah I think it could go either way since there's no userland code API changes. Going to update to minor just to be safe since we're providing a new surface area for the bundler


Export CJS version for browser
5 changes: 4 additions & 1 deletion packages/blob/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"exports": {
".": {
"types": "./dist/src/lib.d.ts",
"browser": "./src/lib.js",
"browser": {
"require": "./dist/src/lib.cjs",
"import": "./src/lib.js"
MichaelDeBoey marked this conversation as resolved.
Show resolved Hide resolved
},
"require": "./dist/src/lib.node.cjs",
"import": "./src/lib.node.js"
}
Expand Down
5 changes: 4 additions & 1 deletion packages/fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"exports": {
".": {
"types": "./dist/src/lib.node.d.ts",
"browser": "./src/lib.js",
"browser": {
"require": "./dist/lib.cjs",
"import": "./src/lib.js"
},
"require": "./dist/lib.node.cjs",
"import": "./src/lib.node.js"
},
Expand Down
45 changes: 31 additions & 14 deletions packages/fetch/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
import {builtinModules} from 'module';
import {dependencies} from './package.json';

export default {
input: 'src/lib.node.js',
output: {
file: 'dist/lib.node.cjs',
format: 'cjs',
esModule: false,
interop: false,
sourcemap: true,
preferConst: true,
exports: 'named',
// https://github.com/rollup/rollup/issues/1961#issuecomment-534977678
outro: 'exports = module.exports = Object.assign(fetch, exports);'
export default [
{
input: 'src/lib.js',
output: {
file: 'dist/lib.cjs',
format: 'cjs',
esModule: false,
interop: false,
sourcemap: true,
preferConst: true,
exports: 'named',
// https://github.com/rollup/rollup/issues/1961#issuecomment-534977678
outro: 'exports = module.exports = Object.assign(fetch, exports);'
},
external: [...builtinModules, ...Object.keys(dependencies)]
},
external: [...builtinModules, ...Object.keys(dependencies)]
};
{
input: 'src/lib.node.js',
output: {
file: 'dist/lib.node.cjs',
format: 'cjs',
esModule: false,
interop: false,
sourcemap: true,
preferConst: true,
exports: 'named',
// https://github.com/rollup/rollup/issues/1961#issuecomment-534977678
outro: 'exports = module.exports = Object.assign(fetch, exports);'
},
external: [...builtinModules, ...Object.keys(dependencies)]
},
];
5 changes: 4 additions & 1 deletion packages/file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
"exports": {
".": {
"types": "./dist/src/lib.d.ts",
"browser": "./src/lib.js",
"browser": {
"require": "./dist/src/lib.cjs",
"import": "./src/lib.js"
},
"require": "./dist/src/lib.node.cjs",
"node": "./src/lib.node.js"
}
Expand Down
5 changes: 4 additions & 1 deletion packages/form-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"exports": {
".": {
"types": "./dist/src/lib.d.ts",
"browser": "./src/lib.js",
"browser": {
"require": "./dist/src/lib.cjs",
"import": "./src/lib.js"
},
"require": "./dist/src/lib.node.cjs",
"import": "./src/lib.node.js"
}
Expand Down
5 changes: 4 additions & 1 deletion packages/stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
"exports": {
".": {
"types": "./src/lib.d.ts",
"browser": "./src/lib.js",
"browser": {
"require": "./src/stream.cjs",
MichaelDeBoey marked this conversation as resolved.
Show resolved Hide resolved
"import": "./src/lib.js"
},
"require": "./src/stream.cjs",
"import": "./src/lib.node.js"
}
Expand Down