-
Notifications
You must be signed in to change notification settings - Fork 317
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
feat: move to ESM #255
feat: move to ESM #255
Conversation
5b7be29
to
2d0e4da
Compare
I tested this out but ran into an issue with the init script - I guess we need to update that here too:
|
2d0e4da
to
0a9ba58
Compare
@brophdawg11 Forgot to rename the file to remove in |
It got farther this time!
I ran into this same error on a project of mine recently and I forget what I did to resolve it. Going to go peek at the commit history... |
Ahh - I added this to
Which looks like it's just a shorthand for |
0a9ba58
to
31a7e6c
Compare
@brophdawg11 I've added the |
69ee48e
to
757b062
Compare
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.
Currently to get the upgrade to v2 to work I need to change the devserver script in the package.json to look like
"dev:serve": "binode --require ./mocks -- @remix-run/serve:remix-serve ./build/index.js",
will these changes fix needing to make this change?
OK the install completes without issue now! I'm still seeing some ESM/CJC issues with the
It looks like |
You can use the built-in NODE_OPTIONS instead of NODE_OPTIONS="--require ./mocks" remix-serve ./build/index.js |
757b062
to
65a294d
Compare
@pcattori I've updated this stack to use |
45a4d33
to
7dab4c6
Compare
gonna want to use |
@mcansh Reverting the imports in @brophdawg11 @pcattori WDYT? |
that would need to be edit: condition needed here https://github.com/remix-run/remix/blob/main/packages/remix-dev/compiler/server/write.ts#L14 (PR: remix-run/remix#7348 that should be back ported to remix v1) diff --git a/package.json b/package.json
index 1f6655f..74cacb4 100644
--- a/package.json
+++ b/package.json
@@ -6,14 +6,14 @@
"scripts": {
"build": "remix build",
"dev": "remix dev -c \"npm run dev:serve\"",
- "dev:serve": "NODE_OPTIONS=\"--require ./mocks\" remix-serve ./build/index.js",
+ "dev:serve": "NODE_OPTIONS=\"--require ./mocks/index.cjs\" remix-serve ./build/index.cjs",
"format": "prettier --write .",
"format:repo": "npm run format && npm run lint:repo -- --fix",
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
"lint:repo": "npm run lint -- --config .eslintrc.repo.cjs",
"setup": "prisma generate && prisma migrate deploy && prisma db seed",
"start": "remix-serve build",
- "start:mocks": "NODE_OPTIONS=\"--require ./mocks\" remix-serve ./build/index.js",
+ "start:mocks": "NODE_OPTIONS=\"--require ./mocks/index.cjs\" remix-serve ./build/index.cjs",
"test": "vitest",
"test:e2e:dev": "start-server-and-test dev http://localhost:3000 \"npx cypress open\"",
"pretest:e2e:run": "npm run build",
diff --git a/remix.config.js b/remix.config.js
index feda42d..8ec75fe 100644
--- a/remix.config.js
+++ b/remix.config.js
@@ -11,6 +11,7 @@ export default {
},
ignoredRouteFiles: ["**/.*", "**/*.test.{js,jsx,ts,tsx}"],
postcss: true,
- serverModuleFormat: "esm",
+ serverModuleFormat: "cjs",
tailwind: true,
+ serverBuildPath: "./build/index.cjs",
}; |
I can't see the commit-by-commit changes due to the rebase/force-push but I'm back to getting this error on install so I can't even get to the Do others get the same error?
|
@brophdawg11 I just ran the command you posted and the seed works fine on my end
|
I left a comment in #257 but due to all the headaches with the ESM stuff I think we should leave the indie stack on CJS for the v2 launch and then convert it to ESM as a separate undertaking. The changes in the |
7dab4c6
to
3f61ea3
Compare
Huh @MichaelDeBoey What version of |
3f61ea3
to
56ab6b9
Compare
@brophdawg11 I'm on Node v16 |
yeah, it seems node 20 is the culprit, I just downgraded to 18 and it worked :/ |
Re-posting from #257 but I think we should hold off on the ESM conversions since they've opened a can of worms. Moving stacks to ESM is not a prerequisite for releasing Remix v2 - they just need to specify
That way we're not finding and trying to backfill bugs we've already fixed in 2.x. Nor do we have to worry about compatibility on anything less than node 18. If everyone's on board, maybe we move these back to draft for the time being? |
56ab6b9
to
ff58ce4
Compare
What's the status on this? I just spent a few hours attempting to move to ESM and it was enough of a pain I thought I'd start this effort if it wasn't done already. I am on remix-run 2.1. I don't fully understand your list there, Matt. It looks like step one is done. What are the future flags / v2 types? |
66a6414
to
8110f1d
Compare
d0fb4ed
to
0442ed9
Compare
v2 is stable and we're prepping for the next release which will be React Router 7 (see this post and this post). I don't think there's anything holding this up from moving forward. I ran
Once we merge that, let's give this another shot and if all's well we can get it merged. |
0442ed9
to
0db1b00
Compare
@brophdawg11 I just rebased this branch onto latest |
0db1b00
to
d1d1ea4
Compare
d1d1ea4
to
1027569
Compare
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.
LGTM! Thanks for seeing this through!
No description provided.