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

feat: move to ESM #206

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MichaelDeBoey
Copy link
Member

Just like I did in remix-run/indie-stack#255


This will also need @mcansh's remix-run/remix#7348

Copy link
Contributor

@brophdawg11 brophdawg11 left a comment

Choose a reason for hiding this comment

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

I don't have docker installed locally so I can't fully validate this, but the install and remix.init run fine for me via npx create-remix --template https://github.com/MichaelDeBoey/blues-stack/tree/move-to-ESM temp 👌

@hs2323
Copy link

hs2323 commented Oct 3, 2024

When applying these changes to an existing Blues Stack, and running npm run dev, I get the following error:

Error: Dynamic require of "path" is not supported

Edit: Found a similar issue when starting the project from scratch (template init) as well.

@MichaelDeBoey MichaelDeBoey force-pushed the move-to-ESM branch 2 times, most recently from 45c0f9f to d1d5d77 Compare October 3, 2024 23:35
@MichaelDeBoey
Copy link
Member Author

@hs2323 Any idea how to solve that? 🤔

@hs2323
Copy link

hs2323 commented Oct 10, 2024

@hs2323 Any idea how to solve that? 🤔

Not sure, it seems to be an issue with the server build. It doesn't like the require module:

🔶 Mock server running
file:///Users/hs2323/Documents/blues-stack/build/server.js:11
  throw Error('Dynamic require of "' + x + '" is not supported');
        ^

Error: Dynamic require of "path" is not supported
    at file:///Users/hs2323/Documents/blues-stack/build/server.js:11:9
    at node_modules/depd/index.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:44:20)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)
    at node_modules/body-parser/index.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:16909:21)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)
    at node_modules/express/lib/express.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:23591:22)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)
    at node_modules/express/index.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:23660:22)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)
    at node_modules/@isaacs/express-prometheus-middleware/src/index.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:28762:20)

When commenting out the exception catch, it produces the following error:

🔶 Mock server running
file:///Users/hs2323/Documents/blues-stack/build/server.js:44
    var relative = __require("path").relative;
                                    ^

TypeError: Cannot read properties of undefined (reading 'relative')
    at node_modules/depd/index.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:44:37)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)
    at node_modules/body-parser/index.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:16909:21)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)
    at node_modules/express/lib/express.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:23591:22)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)
    at node_modules/express/index.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:23660:22)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)
    at node_modules/@isaacs/express-prometheus-middleware/src/index.js (file:///Users/hs2323/Documents/blues-stack/build/server.js:28762:20)
    at __require2 (file:///Users/hs2323/Documents/blues-stack/build/server.js:17:50)

Line 44 of build/server.js

var relative = __require("path").relative;

It seems that it can't read the require from the build. Most likely will require a rewrite of server.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants