Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/react-router-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@
"sideEffects": false,
"main": "./dist/main.js",
"unpkg": "./dist/umd/react-router-dom.production.min.js",
"module": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/main.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"react-router": "workspace:*"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router-dom/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function rollup() {
{
input: `${SOURCE_DIR}/index.ts`,
output: {
file: `${OUTPUT_DIR}/index.js`,
file: `${OUTPUT_DIR}/index.mjs`,
Copy link
Member Author

Choose a reason for hiding this comment

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

We have to use the mjs extension now to prevent this file being resolved as CJS via the import field within exports.

format: "esm",
sourcemap: !PRETTY,
banner: createBanner("React Router DOM", version),
Expand Down
10 changes: 9 additions & 1 deletion packages/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@
"sideEffects": false,
"main": "./dist/main.js",
"unpkg": "./dist/umd/react-router.production.min.js",
"module": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/main.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"turbo-stream": "^2.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function rollup() {
{
input: `${SOURCE_DIR}/index.ts`,
output: {
file: `${OUTPUT_DIR}/index.js`,
file: `${OUTPUT_DIR}/index.mjs`,
format: "esm",
sourcemap: !PRETTY,
banner: createBanner("React Router", version),
Expand Down
7 changes: 7 additions & 0 deletions packages/remix-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"bin": {
"react-router": "dist/cli.js"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/remix-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"tsc": "tsc"
},
Expand Down
1 change: 0 additions & 1 deletion packages/remix-node/install.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/remix-node/install.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/remix-node/install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { installGlobals } from "./globals";

installGlobals();
13 changes: 12 additions & 1 deletion packages/remix-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,19 @@
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./install": {
"types": "./dist/install.d.ts",
"default": "./dist/install.js"
},
"./package.json": "./package.json"
},
"sideEffects": [
"./install.js"
"./dist/install.js"
],
"scripts": {
"tsc": "tsc"
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-node/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = function rollup() {
return [
{
external: (id) => isBareModuleId(id),
input: `${SOURCE_DIR}/index.ts`,
input: [`${SOURCE_DIR}/index.ts`, `${SOURCE_DIR}/install.ts`],
Copy link
Member Author

Choose a reason for hiding this comment

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

Now that we have the exports field, we can point to the dist folder and remove the hard-coded install.js and install.d.ts files.

output: {
banner: createBanner(name, version),
dir: OUTPUT_DIR,
Expand Down
3 changes: 3 additions & 0 deletions packages/remix-serve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"directory": "packages/remix-serve"
},
"license": "MIT",
"exports": {
"./package.json": "./package.json"
},
Copy link
Member Author

Choose a reason for hiding this comment

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

This is only being added to prevent reaching into package internals.

"bin": {
"react-router-serve": "dist/cli.js"
},
Expand Down
10 changes: 9 additions & 1 deletion packages/remix-server-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
"sideEffects": false,
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"module": "dist/esm/index.js",
"module": "dist/esm/index.mjs",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/esm/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"tsc": "tsc"
},
Expand Down
1 change: 1 addition & 0 deletions packages/remix-server-runtime/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module.exports = function rollup() {
dir: `${OUTPUT_DIR}/esm`,
format: "esm",
preserveModules: true,
entryFileNames: "[name].mjs",
},
plugins: [
babel({
Expand Down