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

Remove the macro-getter #633

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

NullVoxPopuli
Copy link
Contributor

Potential solution for #594

@SergeAstapov
Copy link
Collaborator

@NullVoxPopuli yeah, I've tried this some time ago in #455 but those macros don't work as template helpers. Wasn't able to look up the root cause

@NullVoxPopuli
Copy link
Contributor Author

it looks like you removed @embroider/macros. that's what provides the transforms 😅

@SergeAstapov
Copy link
Collaborator

@NullVoxPopuli I've updated #455 to not remove @embroider/macros from deps and still get Error: Attempted to resolve macroCondition, which was expected to be a helper, but nothing was found.

@NullVoxPopuli
Copy link
Contributor Author

that means its making it to runtime -- it's supposed to be compiled away before the app boots. 🤔

@SergeAstapov
Copy link
Collaborator

that means its making it to runtime -- it's supposed to be compiled away before the app boots. 🤔

right, but it's responsibility of @embroider/macros in the context of host app to compile it away... hence I doubt if it's an issue in this lib.

@NullVoxPopuli
Copy link
Contributor Author

could still be both. right now we don't have buildtime dead-branch elimination due to the usage of the getter (unless macros is smart enough to analyze backing JS of co-located components)

@mike-engel
Copy link
Contributor

mike-engel commented Nov 28, 2023

Potential alt for this in #647.

I'm having a heck of a time testing this in our app though, which uses npm instead of pnpm. If I take the build output of this and put it in node_modules/ember-animated/dist/components/animated-container.js though, I'm still getting the error:

ERROR in ../../ember-animated/dist/components/animated-container.js 13:0-58
Module not found: Error: Can't resolve './helpers/-element' in '/Users/mike/projects/ui/node_modules/.embroider/rewritten-app'
resolve './helpers/-element' in '/Users/mike/projects/ui/node_modules/.embroider/rewritten-app'
  using description file: /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/package.json (relative path: ./helpers/-element)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element doesn't exist
      .wasm
        Field 'browser' doesn't contain a valid alias configuration
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element.wasm doesn't exist
      .mjs
        Field 'browser' doesn't contain a valid alias configuration
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element.mjs doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element.json doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element.ts doesn't exist
      .hbs
        Field 'browser' doesn't contain a valid alias configuration
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element.hbs doesn't exist
      .hbs.js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element.hbs.js doesn't exist
      as directory
        /Users/mike/projects/ui/node_modules/.embroider/rewritten-app/helpers/-element doesn't exist
 @ ../../ember-animated/dist/_app_/components/animated-container.js 1:0-71 1:0-71
 @ ./pods/authenticated/post-registration/template.hbs 2:0-81 72:33-51
 @ ./assets/cio.js 3610:13-77

I have no idea why it's not stripping it out during the build. Is there some flag I need to enable? Is this a bug with @embroider/macros?

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

Successfully merging this pull request may close these issues.

3 participants