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

Could not find module with webpack alias AND gts #1800

Open
gossi opened this issue Feb 10, 2024 · 1 comment
Open

Could not find module with webpack alias AND gts #1800

gossi opened this issue Feb 10, 2024 · 1 comment

Comments

@gossi
Copy link
Contributor

gossi commented Feb 10, 2024

My original issue is in #1752 - which I then found out are two issues. So I'm extracting the latter into this one, for which I do have a repro.

When using webpack alias, this works... well until the alias points to an index.gts file. If it is an index.ts file that exports a gts file, then this is the original bug in #1752

The repro is available here: https://github.com/gossi/repro-ember-webpack-alias

Points of interest are:

When importing a gts file from a location under a webpack alias, this doesn't work. Toggling the import statement in the last link would "fix" it.

The error message is unfortunately not very helpful, yet it describes the phenomena:

index.js:605 Uncaught Error: Could not find module `@foo/home` imported from `(require)`
    at missingModule (loader.js:247:1)
    at findModule (loader.js:258:1)
    at requireModule (loader.js:24:1)
    at ../../.pnpm/@embroider+babel-loader-9@3.1.1_@embroider+core@3.4.4_supports-color@8.1.1_webpack@5.90.1/node_modules/@embroider/babel-loader-9/index.js?{"variant":{"name":"dev","runtime":"browser","optimizeForProduction":false},"appBabelConfigPath":"/Users/thomas/code/playground/ember-webpack-alias/node_modules/.embroider/rewritten-app/_babel_config_.js","cacheDirectory":"/private/var/folders/95/bfjp2z0x5l57lzbp6c047rxw0000gn/T/embroider/webpack-babel-loader"}!../../.pnpm/@embroider+webpack@3.2.2_@embroider+core@3.4.4_webpack@5.90.1/node_modules/@embroider/webpack/src/virtual-loader.js?f=%2F%40embroider%2Fext-cjs%2F%40foo%2Fhome&a=%2FUsers%2Fthomas%2Fcode%2Fplayground%2Fember-webpack-alias! (home:2:18)
    at __webpack_require__ (bootstrap:19:1)
    at ./routes/application.ts (router.ts:11:3)
    at __webpack_require__ (bootstrap:19:1)
    at Module.callback (ember-webpack-alias.js:25:57)
    at Module.exports (loader.js:106:1)
    at requireModule (loader.js:27:1)

The cause for this?

Well, the original issue in bug #1752 was embroider resolver's meta is not propagating - and I think it may has to do something with propagation here. Ie. propagating all babel plugins to entries within the alias config?

@mansona
Copy link
Member

mansona commented Feb 10, 2024

This could be something that #1794 intends to try to fix 🤔 the PR is not yet ready to test to see if it fixes your issue but I imagine it will once it's finished

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

No branches or pull requests

2 participants