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

fix for esbuild finding helpers and components from app-tree-merging in templates #2053

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/core/src/module-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,10 @@ export class Resolver {
})
);

if (resolution.type === 'ignored') {
return logTransition(`resolving to ignored component`, request, request.resolveTo(resolution));
}

// .hbs is a resolvable extension for us, so we need to exclude it here.
// It matches as a priority lower than .js, so finding an .hbs means
// there's definitely not a .js.
Expand Down Expand Up @@ -702,7 +706,10 @@ export class Resolver {
})
);

if (helperMatch.type === 'found') {
// for the case of 'ignored' that means that esbuild found this helper in an external
// package so it should be considered found in this case and we should not look for a
// component with this name
if (helperMatch.type === 'found' || helperMatch.type === 'ignored') {
return logTransition('resolve to ambiguous case matched a helper', request, request.resolveTo(helperMatch));
}

Expand Down
30 changes: 29 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"ember-engines": "^0.8.23",
"ember-inline-svg": "^0.2.1",
"ember-modifier": "^4.0.0",
"ember-page-title": "^8.2.3",
"ember-qunit-7": "npm:ember-qunit@^7.0.0",
"ember-source": "~3.28.11",
"ember-source-4.12": "npm:ember-source@~4.12.0",
Expand All @@ -93,8 +94,9 @@
"ember-source-beta": "npm:ember-source@beta",
"ember-source-canary": "https://s3.amazonaws.com/builds.emberjs.com/canary/shas/370cf34f9e86df17b880f11fef35a5a0f24ff38a.tgz",
"ember-source-latest": "npm:ember-source@latest",
"ember-truth-helpers": "^3.0.0",
"ember-test-helpers-2": "npm:@ember/test-helpers@^2.0.0",
"ember-truth-helpers": "^3.0.0",
"ember-welcome-page": "^7.0.2",
"execa": "^5.1.1",
"node-fetch": "2.7.0",
"popper.js": "^1.16.1",
Expand Down
9 changes: 8 additions & 1 deletion tests/scenarios/vite-internals-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ const { module: Qmodule, test } = QUnit;
appScenarios
.only('canary')
.map('vite-internals', app => {
app.linkDevDependency('ember-page-title', { baseDir: __dirname });
app.linkDevDependency('ember-welcome-page', { baseDir: __dirname });
app.mergeFiles({
app: {
components: {
'fancy-button.hbs': `<h1>I'm fancy</h1>`,
},
templates: {
'application.hbs': '<FancyButton />',
'application.hbs': `{{page-title "MyApp"}}

<FancyButton />
{{outlet}}

<WelcomePage />`,
},
},
});
Expand Down