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

Incorrect resolve attached to ember-source. ModuleNotFoundError. #849

Closed
esbanarango opened this issue Jun 14, 2021 · 9 comments
Closed

Comments

@esbanarango
Copy link

Similar issue to #817. I have an app where I'm trying out embroider. This app uses mirage, and it depends on pretender "^3.4.3". I'm getting this build error:

Build Error (PackagerRunner) in ../../../../../../../../Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js

Module not found: Error: Can't resolve 'ember-source/route-recognizer/index.js' in '/Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js'

pretender_es_js_—_workspace__Workspace_

Somehow it's trying to resolve route-recognizer from ember-source/route-recognizer/index.js ? 🤔

Logs
ERROR Summary:
  • broccoliBuilderErrorStack: ModuleNotFoundError: Module not found: Error: Can't resolve 'ember-source/route-recognizer/index.js' in '/Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js'
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/Compilation.js:1762:28
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:732:13
    at eval (eval at create (/Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), :8:1)
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:274:22
    at eval (eval at create (/Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), :7:1)
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:403:22
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:117:11
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:648:24
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:802:8
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:922:5
  • code: [undefined]
  • codeFrame: Module not found: Error: Can't resolve 'ember-source/route-recognizer/index.js' in '/Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js'
  • errorMessage: ../../../../../../../../Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js: Module not found: Error: Can't resolve 'ember-source/route-recognizer/index.js' in '/Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js'
    at PackagerRunner (@embroider/webpack)
  • errorType: Build Error
  • location:
    • column: [undefined]
    • file: ../../../../../../../../Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js
    • line: [null]
    • treeDir: [undefined]
  • message: ../../../../../../../../Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js: Module not found: Error: Can't resolve 'ember-source/route-recognizer/index.js' in '/Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js'
    at PackagerRunner (@embroider/webpack)
  • name: Error
  • nodeAnnotation: @embroider/webpack
  • nodeName: PackagerRunner
  • originalErrorMessage: Module not found: Error: Can't resolve 'ember-source/route-recognizer/index.js' in '/Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js'
  • stack: ModuleNotFoundError: Module not found: Error: Can't resolve 'ember-source/route-recognizer/index.js' in '/Users/esbanarango/Developer/embroiderTestApp/node_modules/pretender/dist/pretender.es.js'
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/Compilation.js:1762:28
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:732:13
    at eval (eval at create (/Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), :8:1)
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:274:22
    at eval (eval at create (/Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), :7:1)
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:403:22
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:117:11
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:648:24
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:802:8
    at /Users/esbanarango/Developer/embroiderTestApp/node_modules/webpack/lib/NormalModuleFactory.js:922:5
"@embroider/compat": "^0.41.0",
"@embroider/core": "^0.41.0",
"@embroider/webpack": "^0.41.0",
...
"ember-source": "3.28.0-beta.5"
"ember-cli-babel": "^7.26.6",
"ember-cli-mirage": "2.2.0",
@mydea
Copy link
Contributor

mydea commented Jun 15, 2021

I encountered the same issue. I created an issue with a minimal reproduction over in ember-source, not sure where this belongs to:
emberjs/ember.js#19601

@ef4
Copy link
Contributor

ef4 commented Jun 15, 2021

Thanks for reporting. This is indeed the same issue as #817.

We can probably do a fancier CompatAdapter for ember-source that would fix its own references to these packages without leaking rules that change everybody else's references to them.

But ultimately ember-source needs to ship something that makes more sense: either stop bundling in these dependencies, or keep bundling them but import them via relative paths instead of expecting them to be resolvable by their original package names.

@esbanarango
Copy link
Author

@ef4 Thank you 🙏

We can probably do a fancier CompatAdapter for ember-source that would fix its own references to these packages without leaking rules that change everybody else's references to them.

Is this ^ being considerated at all?

@alexlafroscia
Copy link
Contributor

alexlafroscia commented Jul 20, 2021

@ef4 is it the customAddonTree that is updating the module paths? I'd love to try to fix this, but reading through the ember-source compat adapter I can't quite find anything that looks like it's updating module paths

private customAddonTree() {
return mergeTrees([
buildFunnel(this.rootTree, {
srcDir: 'dist/packages',
}),
buildFunnel(this.rootTree, {
srcDir: 'dist/dependencies',
}),
]);
}

If you have an idea of what this fancier compat adapter would look like and can walk through the gist of it, I'd be up for trying to get the compat adapter working to resolve this issue

@esbanarango
Copy link
Author

@alexlafroscia let me know if you have any in-progress branch I can test with 🙏

@alexlafroscia
Copy link
Contributor

I wish I could say I did, but without having any idea where to start digging into this, I don't have anything in progress 😦

@ef4
Copy link
Contributor

ef4 commented Aug 11, 2021

There is now some in progress work for this issue here: #919

@esbanarango
Copy link
Author

That's great! Thank you @ef4

@lolmaus
Copy link
Collaborator

lolmaus commented Aug 16, 2023

This issue should no longer happen with latest Embroider. If you encounter the issue in the latest Embroider version, don't hesitate to ping to reopen.

@mansona mansona closed this as completed Aug 16, 2023
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

6 participants