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

bareImports.js does not handle ESM/TS path aliases #7275

Closed
1 task done
cyberwombat opened this issue Aug 28, 2023 · 4 comments
Closed
1 task done

bareImports.js does not handle ESM/TS path aliases #7275

cyberwombat opened this issue Aug 28, 2023 · 4 comments

Comments

@cyberwombat
Copy link

What version of Remix are you using?

1.19.1

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

Given a path alias in TSConfig:

"paths": {
      "~/*": ["app/*"]
    },

and package.json set to:

"type":"module"

I get errors in remix run module node_modules/@remix-run/dev/dist/compiler/server/plugins/bareImports.js when doing an import in my code such as:

import { getLocaleFromRequest } from '~/lib/utils.js'

The code runs though. I am currently commenting out that error log. I am using this as part of Shopify Hydrogen using their demo store but with type set to module. Works fine without that so I think something needs ESM addressing.

Expected Behavior

No errors to be thrown

Actual Behavior

Screenshot 2023-08-28 at 7 34 48 AM
@pcattori
Copy link
Contributor

Fixed by #6916 . You can try it out now with npx upgrade-remix 2.0.0-pre.2

@MichaelDeBoey MichaelDeBoey added the needs-response We need a response from the original author about this issue/PR label Aug 29, 2023
@MichaelDeBoey MichaelDeBoey removed the needs-response We need a response from the original author about this issue/PR label Aug 31, 2023
@cyberwombat
Copy link
Author

This is still an issue. I am on 2.3.0

@cyberwombat
Copy link
Author

Given a route with a tilde path the dev server fails with:

[remix] Error: Cannot find package '~' imported from /Users/User/App/build/index.js
[remix]     at new NodeError (node:internal/errors:405:5)
[remix]     at packageResolve (node:internal/modules/esm/resolve:887:9)
[remix]     at moduleResolve (node:internal/modules/esm/resolve:936:20)
[remix]     at defaultResolve (node:internal/modules/esm/resolve:1129:11)
[remix]     at nextResolve (node:internal/modules/esm/loader:163:28)
[remix]     at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
[remix]     at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
[remix]     at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
[remix]     at link (node:internal/modules/esm/module_job:76:36)

@typytypytypy
Copy link

@cyberwombat did you figure out how to resolve this? I have the same issue

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

No branches or pull requests

5 participants