ember-twiddle icon indicating copy to clipboard operation
ember-twiddle copied to clipboard

Build fails for addons that are using `@embroider/macros`

Open jelhan opened this issue 3 years ago • 3 comments

If an addon is using @embroider/macros the build fails:

- Installing addon package

- Installing addon package
Installing packages... This might take a couple of minutes.
- Installing addon package
- npm: Installing [email protected] ...
npm: Installed [email protected]
installing ember-bootstrap
Installing for Bootstrap 4 using preprocessor none
  install package bootstrap

Installing packages... This might take a couple of minutes.
- npm: Installing bootstrap@^4.3.1 ...
npm: Installed bootstrap@^4.3.1
Configuration file could not be edited. Manually update your ember-cli-build.js to include 'ember-bootstrap': {"bootstrapVersion":4,"importBootstrapCSS":true}
Installed addon package.
- Building
[Embroider:MacrosConfig] cannot read userConfigs until MacrosConfig has been finalized.


Stack Trace and Error Report: /tmp/error.dump.67c8db1caf05113d786b2c2ccd26a6b8.log

No addon.js created

To be honest I'm not 100%ly sure if embroider build time macros are causing the issue. I'm seeing the above error message with ember-bootstrap@^4.0.0. As far as I'm aware it's the only addon using @embroider/macros. So I haven't tested with any other.

Please not that @embroider/macros are working fine in a default ember project. They do not require embroider build.

I have tested on ember-twiddle.com and canary.ember-twiddle.com. Adding { "ember-bootstrap": "4.0.0" } to the list of addons is enough to see the error.

jelhan avatar Aug 21 '20 15:08 jelhan

@jelhan You can test the build by cloning https://github.com/joostdevries/twiddle-backend and running the test-ember-version-locally.sh script. I might not be able to get to this quickly. Please ask if you have any issues.

Gaurav0 avatar Aug 24 '20 13:08 Gaurav0

Thanks a lot for sharing that information.

I was able to reproduce the bug locally by running ./test-ember-version-locally.sh 3.18.0 ember-bootstrap 4.0.0. But the stack trace is not that helpful:

ERROR Summary:

  - broccoliBuilderErrorStack: [undefined]
  - code: [undefined]
  - codeFrame: [undefined]
  - errorMessage: [Embroider:MacrosConfig] cannot read userConfigs until MacrosConfig has been finalized.
  - errorType: [undefined]
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
  - message: [Embroider:MacrosConfig] cannot read userConfigs until MacrosConfig has been finalized.
  - name: Error
  - nodeAnnotation: [undefined]
  - nodeName: [undefined]
  - originalErrorMessage: [undefined]
  - stack: Error: [Embroider:MacrosConfig] cannot read userConfigs until MacrosConfig has been finalized.
    at MacrosConfig.get userConfigs [as userConfigs] (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/@embroider/macros/src/macros-config.js:98:19)
    at Object.get userConfigs [as userConfigs] (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/@embroider/macros/src/macros-config.js:133:29)
    at _clone (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/clone/clone.js:162:31)
    at _clone (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/clone/clone.js:162:18)
    at _clone (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/clone/clone.js:162:18)
    at _clone (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/clone/clone.js:162:18)
    at clone (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/clone/clone.js:202:10)
    at Class._getAddonProvidedConfig (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/ember-cli-babel/index.js:251:19)
    at Class._getBabelOptions (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/ember-cli-babel/index.js:270:36)
    at Class.buildBabelOptions (/home/jelhan/tmp/twiddle-backend/tmp/3.18.0/node_modules/ember-cli-babel/index.js:33:17)

Will try to dig deeper into it later. Just wanted to leave this here for reference in case someone else has the time to pick it up earlier.

jelhan avatar Aug 24 '20 14:08 jelhan

See also https://github.com/embroider-build/embroider/issues/882 Is there a way to override low-level things like ember-cli-handlebars in a twiddle?

jacobq avatar Apr 28 '22 21:04 jacobq