Skip to content

Commit

Permalink
feat(compile route templates): skip template-colocation-plugin for ro…
Browse files Browse the repository at this point in the history
…ute templates
  • Loading branch information
BlueCutOfficial committed Mar 26, 2024
1 parent 894d238 commit 37aba1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions packages/shared-internals/src/template-colocation-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export default function main(babel: typeof Babel) {
}
}

// TODO: indentify a route template to skip the plugin
if (filename.includes('just-a-template')) {
debug('not handling colocation for %s', filename);
return;
}

debug('handling colocation for %s', filename);
let extensions = state.opts.templateExtensions ?? ['.hbs'];
for (let ext of extensions) {
Expand Down
4 changes: 1 addition & 3 deletions tests/scenarios/v2-addon-dev-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,7 @@ appScenarios
expectFile(
'dist/components/demo/just-a-template.js'
).equalsCode(`import { precompileTemplate } from '@ember/template-compilation';
import { setComponentTemplate } from '@ember/component';
var TEMPLATE = precompileTemplate("<p>I am not a component but a template.</p>");
var justATemplate = setComponentTemplate(TEMPLATE, precompileTemplate("<p>I am not a component but a template.</p>"));
var justATemplate = precompileTemplate("<p>I am not a component but a template.</p>");
export { justATemplate as default };
//# sourceMappingURL=just-a-template.js.map`);
});
Expand Down

0 comments on commit 37aba1f

Please sign in to comment.