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

Setting enableTypeScriptTransform to true breaks imports in .gjs tests #228

Closed
azhiv opened this issue Jan 18, 2024 · 6 comments
Closed

Comments

@azhiv
Copy link

azhiv commented Jan 18, 2024

I'm trying to add TS declarations to our V2 addon and to modify the test-app so that it properly consumes those declarations. The initial state of the repository was as follows:

  • the V2 addon has no *.d.ts files
  • the test-app has no TS support, however it has a .gjs test file which runs successfully

I then followed this instruction to add declaration files to the addon.
The problem is when I add TS-related dependencies to the test-app (all source files extensions are preserved) and set 'ember-cli-babel': { enableTypeScriptTransform: true }, in ember-cli-build.js, the tests start failing with a very generic error "Could not find module <addon-name> imported from test-app/tests/integration/helpers/<gjs-test>". Here's the PR which reproduces the error, this is the exact test output.

Note that without setting 'ember-cli-babel': { enableTypeScriptTransform: true }, the tests succeed. Please also note that ember-cli-typescript is omitted.

Am I missing some piece of configuration?

PS: This is the difference in the output tree before and after setting enableTypeScriptTransform:

Screenshot 2024-01-18 at 18 12 07 Screenshot 2024-01-18 at 18 11 24
@azhiv azhiv changed the title Setting enableTypeScriptTransform to true breaks imports in .gjs tests Setting enableTypeScriptTransform to true breaks imports in .gjs tests Jan 18, 2024
@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Jan 18, 2024

Thanks for reporting (and provided a repro repo), I'll look in to this, as I believe this may be the issue I'm seeing in a work-related project!

@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Jan 19, 2024

So far, I've noticed that the issue reproduces only in classic (broccoli-only) mode -- @embroider/webpack (and @embroider/vite) do not have this issue.

@azhiv
Copy link
Author

azhiv commented Jan 29, 2024

@NullVoxPopuli Is there a workaround we could apply, e.g. switching to the above mentioned bundlers?

@NullVoxPopuli
Copy link
Collaborator

right now the only work around I know of is to use v3 of template-imports. I have a hunch the babel config we have with ember-cli-babel may not be playing well with v4 of template-imports.

Sorry it took so long to reply, this week's been nuts

@andreyfel
Copy link

Seems that the issue is resolved now with the latest release of babel-plugin-ember-template-compilation after this change emberjs/babel-plugin-ember-template-compilation#34

@NullVoxPopuli
Copy link
Collaborator

Confirmed!

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

3 participants