embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
329 stars 137 forks source link

V1 addon (TypeScript) with app/components/some-component.ts fails to find the component #1857

Open raido opened 1 month ago

raido commented 1 month ago

V1 addon with structure like this:

addon/components
   some-component.ts
   some-component.hbs
app/components
  some-component.ts // which just re-exports addon/components with absolute path (package-name/addon/...);

Fails to build (embroider-safe, embroider-optimized scenarios) with errror:

Attempted to resolve 'some-component', which was expected to be a component, but nothing was found.

Workaround

Renaming app/components/some-component.ts -> app/components/some-component.js and the build succeeds.

Context

@embroider/core 2.1.1 
@embroider/webpack 2.1.1 
@embroider/compat 2.1.1
webpack 5.91.0
ember-source ~4.12.0

// ember-cli-build.js

const app = new EmberAddon(defaults, {
    "ember-cli-babel": {
      enableTypeScriptTransform: true,
    },
}
NullVoxPopuli commented 1 month ago

in your addon, do you have:

options: {
  'ember-cli-babel': {
    enableTypeScriptTransform: true
  }
}

?

https://github.com/emberjs/ember-cli-babel?tab=readme-ov-file#enabling-typescript-transpilation

raido commented 1 month ago

Yes, I do. The whole context up 🔝 is from the addon perspective.

raido commented 1 month ago

Any updates here?