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

Example doesn't work #8

Closed
3x071c opened this issue Mar 27, 2022 · 14 comments · Fixed by #9
Closed

Example doesn't work #8

3x071c opened this issue Mar 27, 2022 · 14 comments · Fixed by #9
Assignees
Labels
bug Something isn't working

Comments

@3x071c
Copy link

3x071c commented Mar 27, 2022

Trying to get this to run with my Cloudflare Pages + Remix + Emotion + Chakra-UI app. After following the README.md guide, I'm encountering the following error:

$ npm run dev
Building Remix app in development mode...
Error: Error loading Remix config in /Users/.../remix.config.js
    at Object.readConfig (/Users/.../node_modules/@remix-run/dev/config.js:67:11)
    at Object.build (/Users/.../node_modules/@remix-run/dev/cli/commands.js:151:31)
    at Object.run (/Users/.../node_modules/@remix-run/dev/cli/run.js:351:22)
    at Object.<anonymous> (/Users/.../node_modules/@remix-run/dev/cli.js:16:11)

First I thought this was a misconfiguration problem (or possibly an incompatibility with CF Pages), but it turns out that your /example runs into the same problem. I see that this package was just freshly upgraded 5 hours ago, so I'll downgrade to v1 for now. Thank you for investing your time in maintaining this publically, can't wait to have this fixed! 💯

@aiji42
Copy link
Owner

aiji42 commented Mar 28, 2022

@3x071c Thanks for actually using this library.
I am wondering why you are getting errors like the one you presented, since I have verified that /example is running correctly, as shown in the image below.

スクリーンショット 2022-03-28 午前9 43 23

I would like to know in order to streamline my investigation.

  • What is the version of Node in your environment?
  • Downgrade remix-esbuild-override to v1 in your repository and get the same error?

@gnimmelf
Copy link

gnimmelf commented Mar 28, 2022

I can confirm same error;

node -v
v16.14.2
npm -v
8.5.0

Both
"remix-esbuild-override": "^1.0.0",
"remix-esbuild-override": "^2.0.0",
fail with same error, so only diff is yarn vs npm?

Cheers!

@aiji42
Copy link
Owner

aiji42 commented Mar 28, 2022

@gnimmelf Thanks for the detailed information. This will help me in my investigation.
I promise to address and resolve the issue as soon as possible.

@aiji42 aiji42 added the bug Something isn't working label Mar 28, 2022
@aiji42 aiji42 self-assigned this Mar 28, 2022
@3x071c
Copy link
Author

3x071c commented Mar 28, 2022

@aiji42 Thanks for investigating. Perhaps this is an npm-specific issue?

@aiji42
Copy link
Owner

aiji42 commented Mar 28, 2022

@3x071c I have not yet been able to determine the cause of the problem, but I believe it is likely.

@aiji42
Copy link
Owner

aiji42 commented Mar 28, 2022

remix-esbuild-override intercepts the esbuild call from remix by rewriting the path to esbuild under node_modules using the file system.
I suspect that the error is caused by a slight difference in the configuration of the directory under node_modules during module installation between yarn and npm.

@aiji42
Copy link
Owner

aiji42 commented Mar 28, 2022

@3x071c @gnimmelf
Can you try to delete node_modules/@remix-run/dev/node_modules/esbuild and run the development command to see if it starts?

rm -rf node_modules/@remix-run/dev/node_modules/esbuild
npm run dev

@3x071c
Copy link
Author

3x071c commented Mar 28, 2022

I would like to know in order to streamline my investigation.

  • What is the version of Node in your environment?

I'm using the latest Node.js version (17.8.0), with npm

  • Downgrade remix-esbuild-override to v1 in your repository and get the same error?

Downgrading and reconfiguring remix-esbuild-override to 1.2.2 works with Remix 1.3.x. Confusingly, it doesn't with Remix 1.2.x.

@marcus-sa
Copy link

node_modules/@remix-run/dev/node_modules/esbuild

Weird, that doesn't work for me.

@aiji42
Copy link
Owner

aiji42 commented Mar 28, 2022

@marcus-sa Thanks for letting me know.
Is the error you observed the same as the error @3x071c presented at the beginning of the Issue?

@marcus-sa
Copy link

marcus-sa commented Mar 28, 2022

@aiji42 this is the error I'm getting
Cannot find module 'esbuild-org'
at Object.<anonymous> (/home/marcus-sa/Git/marcus-sa/xxx/node_modules/remix-esbuild-override/dist/index.js:18:14)

@aiji42
Copy link
Owner

aiji42 commented Mar 28, 2022

@3x071c @marcus-sa @gnimmelf
I am currently working on bug fixes and have just released a beta version. Please help me debug it.

Install

Remove the node_modules directory in advance

rm -rf node_modules

npm install -D remix-esbuild-override@beta
# or
yarn add -D remix-esbuild-override@beta

2.0.1-beta.4 will be installed.

Add remix-esbuild-override to scripts.postinstall in package.json.

"scripts": {
  "postinstall": "remix setup cloudflare && remix-esbuild-override"
}

Run npm install or yarn install again and verify that the following message appears in the log.

💽 esbuild patch by remix-esbuild-override is complete.

Setup

The setup procedure is the same as the current README for the main branch.

// remix.config.js
const { withEsbuildOverride } = require("remix-esbuild-override");

withEsbuildOverride((option, { isServer, isDev }) => {
  // write your custome option for esbuild
  return option;
})

/**
 * @type {import('@remix-run/dev').AppConfig}
 */
module.exports = {
  // ...
};

Start up a development server

npm run dev
# or
yarn run dev

@3x071c
Copy link
Author

3x071c commented Mar 28, 2022

@aiji42 Works great for me! Thank you. 👍

@aiji42
Copy link
Owner

aiji42 commented Mar 29, 2022

I am making this release and closing the issue. Thank you all for your help in reporting and debugging.
I am hopeful that the errors you have reported have been resolved, but if they recur, please re-open the issue.

@aiji42 aiji42 closed this as completed in #9 Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants