ericclemmons / click-to-component

Option+Click React components in your browser to instantly open the source in VS Code
MIT License
1.79k stars 63 forks source link

Add Remix/ESBuild support by checking the _debugOwner._debugSource #73

Closed HosseinAgha closed 7 months ago

HosseinAgha commented 1 year ago

As Remix/ESBuild _debugSource filepaths are relative I had to also add GaitanK's code in order to make path absolute in my Remix app.

ESBuild has added _debugSource for a long time now https://github.com/evanw/esbuild/issues/2318 but looks like at least in React 18 we need to read it from somewhere else.

@ericclemmons, happy to have your feedback on this.

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: d62564cdc0cc9f668911389792001fb1c0a74c2a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------------ | ----- | | click-to-react-component | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

maxxborer commented 8 months ago

Will remix support be accepted? PR is already half a year old, are there any problems with this?

Also in the latest remix version (2.1.0) I get:

/node_modules/cliui/build/index.cjs:291
const stringWidth = require('string-width');
                    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/string-width/index.js from /node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
maxxborer commented 8 months ago

Will remix support be accepted? PR is already half a year old, are there any problems with this?

Also in the latest remix version (2.1.0) I get:

/node_modules/cliui/build/index.cjs:291
const stringWidth = require('string-width');
                    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/string-width/index.js from /node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.

oops, I added click-to-react-component to serverDependenciesToBundle in remix.config.js and everything worked.