question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`unable to resolve package {addon-name}` when using HFTNB syntax to reference components in the same addon

See original GitHub issue

repo to reproduce: https://github.com/yangpiao/test-hftnb-embroider

Ran into this build error when I use HFTNB syntax in an addon to reference other components / helpers in the same addon.

E.g.

{{! test-hftnb-embroider/addon/components/foo-bar.hbs }}
<TestHftnbEmbroider$Lorem>
  {{yield}}
</TestHftnbEmbroider$Lorem>

I have set excludeNestedAddonTransforms to true, and the static***** options to true as well (ember-cli-build.js).

Build output:

$ ember b --environment test

Building into /private/var/folders/rj/swxy20tx7gx45_mmdxhdx80c000vbq/T/embroider/72ccc5
Environment: test
⠇ building... [@embroider/webpack]assets by chunk 640 KiB (id hint: vendors)
  asset chunk.952b5c45014cea2d5253.js 580 KiB [emitted] [immutable] [big] (id hint: vendors)
  asset chunk.a946c09be6f023797849.js 60.2 KiB [emitted] [immutable] (id hint: vendors)
asset chunk.36103af21939696d2b1e.js 34.9 KiB [emitted] [immutable] (name: assets/test.js)
asset chunk.a313cbe39e682ad36e3f.js 23 KiB [emitted] [immutable] (name: assets/dummy.js)
Entrypoint assets/dummy.js 83.2 KiB = chunk.a946c09be6f023797849.js 60.2 KiB chunk.a313cbe39e682ad36e3f.js 23 KiB
Entrypoint assets/test.js [big] 675 KiB = chunk.a946c09be6f023797849.js 60.2 KiB chunk.952b5c45014cea2d5253.js 580 KiB chunk.36103af21939696d2b1e.js 34.9 KiB
runtime modules 6.74 KiB 13 modules
modules by path ../../node_modules/ 258 KiB 78 modules
modules by path ./ 8.3 KiB 11 modules
modules by path ../../../ 243 KiB
  modules by path ../../../../../../../../../../Users/ypiao/ui/tests/test-hftnb-embroider/node_modules/@babel/runtime/helpers/esm/*.js 1.63 KiB 4 modules
  ../../../../../../../../../../Users/ypiao/ui/tests/test-hftnb-embroider/node_modules/qunit/qunit/qunit.js 242 KiB [built] [code generated]
  ../../../externals/require.js 108 bytes [built] [code generated]
modules by path ../../components/ 612 bytes
  modules by path ../../components/*.js 346 bytes 2 modules
  modules by path ../../components/*.hbs 266 bytes
    ../../components/foo-bar.hbs 1 bytes [built] [code generated] [1 error]
    ../../components/lorem.hbs 265 bytes [built] [code generated]

ERROR in ../../components/foo-bar.hbs
Module Error (from ../../../../../../../../../../Users/ypiao/ui/tests/test-hftnb-embroider/node_modules/thread-loader/dist/cjs.js):
unable to resolve package test-hftnb-embroider from $TMPDIR/embroider/72ccc5
Thread Loader (Worker 1)
unable to resolve package test-hftnb-embroider from $TMPDIR/embroider/72ccc5

    at PackageCache.resolve (/Users/ypiao/ui/tests/test-hftnb-embroider/node_modules/@embroider/shared-internals/src/package-cache.js:29:21)
    at CompatResolver.tryComponent (/Users/ypiao/ui/tests/test-hftnb-embroider/node_modules/@embroider/compat/src/resolver.js:411:77)
    at CompatResolver.resolveElement (/Users/ypiao/ui/tests/test-hftnb-embroider/node_modules/@embroider/compat/src/resolver.js:576:26)
    at enter (/Users/ypiao/ui/tests/test-hftnb-embroider/node_modules/@embroider/compat/src/resolver-transform.js:141:57)
    at visitNode ($TMPDIR/embroider/72ccc5/node_modules/ember-source/vendor/ember/ember-template-compiler.js:11763:16)
    at visitArray ($TMPDIR/embroider/72ccc5/node_modules/ember-source/vendor/ember/ember-template-compiler.js:11855:20)
    at visitKey ($TMPDIR/embroider/72ccc5/node_modules/ember-source/vendor/ember/ember-template-compiler.js:11831:7)
    at visitNode ($TMPDIR/embroider/72ccc5/node_modules/ember-source/vendor/ember/ember-template-compiler.js:11785:9)
    at traverse ($TMPDIR/embroider/72ccc5/node_modules/ember-source/vendor/ember/ember-template-compiler.js:11896:5)
    at preprocess ($TMPDIR/embroider/72ccc5/node_modules/ember-source/vendor/ember/ember-template-compiler.js:13445:9)
 @ ../../components/foo-bar.js 2:0-37 3:36-44
 @ ./tests/integration/components/foo-bar-test.js 1:0-54 3:9-11
 @ ./assets/test.js 4:9-67

webpack 5.65.0 compiled with 1 error in 7009 ms

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rwjbluecommented, Mar 28, 2022

Should be resolved by #1170

0reactions
angelayanpancommented, Apr 15, 2022

hi, it seems that the service usage of batman syntax is still not resolved with embroider 1.6 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to resolve package source 'https://www ...
But if i RDP into the same computer (same user context) and run the same command, it works without errors/warnings. The Powershell repository...
Read more >
powershell-fix-warning-unable-to-resolve-package-source ...
A fix for PowerShell Gallery error " PackageManagementFind-Package : No match was found for the specified search criteria and module name "
Read more >
How to Fix PowerShell Unable to Resolve Package Source in ...
Steps by steps guide: https://bonguides.com/ how -to-fix-powershell- unable -to- resolve - package -source/- ...
Read more >
Ember CLI generate component in an addon - Stack Overflow
After struggling a little bit with npm, I tried it again (without sudo) and the same thing happened. I'm on Ember CLI 0.2.1....
Read more >
Piotr Tarnawski - Angry Admin
PowerShell – WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'. ... I was going to update the PowerCLI module ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found