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

Virtual modules as transitive dependency break build #214

Open
buschtoens opened this issue Nov 27, 2020 · 0 comments
Open

Virtual modules as transitive dependency break build #214

buschtoens opened this issue Nov 27, 2020 · 0 comments

Comments

@buschtoens
Copy link
Contributor

buschtoens commented Nov 27, 2020

If an addon (direct-addon) has a dependency onto another addon (intermediary-addon) that depends on a third addon (transitive-addon) that provides virtual modules, the build breaks.

  • host-app
    • app with a direct dependency on direct-addon
  • direct-addon
    • addon with a direct dependency on intermediary-addon
    • composes local-classes from intermediary-addon physical .css files
  • intermediary-addon
    • addon with a direct dependency on transitive-addon
    • imports @values or composes local-classes from transitive-addon's virtual modules
  • transitive-addon
    • an addon without any physical .css files
    • provides virtual modules

Running ember s inside intermediary-addon works.
But running ember s inside direct-addon or host-app does not.

The actual error thrown is:

Error: Unable to resolve styles module 'transitive-addon/virtual-module' imported from '/Users/jan/demo/direct-addon/addon/components/some-component/styles.css'. No virtual module with that name was defined and no corresponding addon was found.
    at resolveExternalPath (/Users/jan/demo/node_modules/ember-css-modules/lib/resolve-path.js:55:11)
    at ModulesPreprocessor.resolvePath [as _resolvePath] (/Users/jan/demo/node_modules/ember-css-modules/lib/resolve-path.js:14:12)
    at ModulesPreprocessor.resolvePath (/Users/jan/demo/node_modules/ember-css-modules/lib/modules-preprocessor.js:185:17)
    at ModulesPreprocessor.resolveAndRecordPath (/Users/jan/demo/node_modules/ember-css-modules/lib/modules-preprocessor.js:156:25)
    at CSSModules.fetchExports (/Users/jan/demo/node_modules/broccoli-css-modules/index.js:138:29)
    at fetchImport (/Users/jan/demo/node_modules/broccoli-css-modules/lib/link-modules.js:40:34)
    at /Users/jan/demo/node_modules/broccoli-css-modules/lib/link-modules.js:31:20
    at Root.each (/Users/jan/demo/node_modules/postcss/lib/container.js:105:16)
    at fetchAllImports (/Users/jan/demo/node_modules/broccoli-css-modules/lib/link-modules.js:29:7)
    at /Users/jan/demo/node_modules/broccoli-css-modules/lib/link-modules.js:19:24

But it gets swallowed as:

Error: Unable to locate module "direct-addon/components/some-component/styles" imported from /var/folders/zd/7ly06mpn2t512t2fr1g1ppw80000gq/T/broccoli-88502T1X0zlnjt79z/out-3664-module_source_funnel/direct-addon/components/other-component/styles.css
    at ModulesPreprocessor.onModuleResolutionFailure (/Users/jan/demo/node_modules/ember-css-modules/lib/modules-preprocessor.js:133:11)
    at /Users/jan/demo/node_modules/broccoli-css-modules/lib/link-modules.js:54:13
    at tryCatcher (/Users/jan/demo/node_modules/rsvp/dist/lib/rsvp/-internal.js:39:19)
    at invokeCallback (/Users/jan/demo/node_modules/rsvp/dist/lib/rsvp/-internal.js:211:31)
    at publish (/Users/jan/demo/node_modules/rsvp/dist/lib/rsvp/-internal.js:197:7)
    at publishRejection (/Users/jan/demo/node_modules/rsvp/dist/lib/rsvp/-internal.js:132:3)
    at flush (/Users/jan/demo/node_modules/rsvp/dist/lib/rsvp/asap.js:80:5)
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

When I add transitive-addon as a direct dependency to direct-addon as well, it works.

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

1 participant