-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[5.10] Can't import the template-compiler #20718
Comments
I've reproduced the issue over at NullVoxPopuli/limber#1787 This is a runtime error |
so far, it seems the the fix is to remove the |
I'm confused... how can I remove it if I need it? |
apologies, I'm still working this out, A couple tests,
|
for hbs-only compiling, I use: const { precompileJSON } = importSync('@glimmer/compiler');
const { getTemplateLocals } = importSync('@glimmer/syntax'); and for gjs compiling, I use: const compiler = importSync('ember-source/dist/ember-template-compiler.js'); because babel-plugin-ember-template-compilation asks that of me in its API.
So, looking at the source for the template-compiler, https://github.com/emberjs/ember.js/blob/main/packages/ember-template-compiler/lib/public-api.ts, I can re-create this, using the imports that do happen to work: export { preprocess as _preprocess, print as _print } from '@glimmer/syntax';
export { default as precompile } from './system/precompile';
export { buildCompileOptions as _buildCompileOptions } from './system/compile-options'; precompile is ultimately: import { precompile as glimmerPrecompile } from '@glimmer/compiler';
export default function precompile(templateString, options = {}){
return glimmerPrecompile(templateString, compileOptions(options));
} and yadda yadda for the compiler options -- for the REPL purposes, it's possible I don't need that half that stuff -- since the REPL doesn't have as strict of compatibility requirements as ember-source does. but anyyyyway -- the crux of the problem is this line:
Something has gone wrong with teh
it looks like you don't need |
This should be fixed by #20726 which is about to go out as 5.10.2 |
The fix is released in v5.10.2 and v5.11.0-beta.2 |
I don't think this is fixed. For example, npx ember-cli@latest new my-template-compiler-app --pnpm --embroider
cd my-template-compiler-app
pnpm add @embroider/macros
pnpm start then, in import { importSync } from '@embroider/macros';
console.log(importSync('ember-source/dist/ember-template-compiler.js')); and after visiting which is the empty module object 🤔 |
The documented way to add the runtime template compiler to ember is to use |
So, getting rid of
This makes everything work importSync
This is irrelevant now, but Whether or not the rest of the template compiler came with via importSync is 🤷 |
🐞 Describe the Bug
Upgrading from 5.9 to 5.10 and importing the template compiler leads to:
🔬 Minimal Reproduction
😕 Actual Behavior
That error.
🤔 Expected Behavior
No error.
🌍 Environment
The text was updated successfully, but these errors were encountered: