Open boris-petrov opened 1 week ago
I've reproduced the issue over at https://github.com/NullVoxPopuli/limber/pull/1787
This is a runtime error
so far, it seems the the fix is to remove the app.import
I'm confused... how can I remove it if I need it?
I'm confused... how can I remove it if I need it?
apologies, I'm still working this out,
A couple tests,
app.import
is still not needed, even though it doesn't always fix the problem. I need to check my imports.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. but really it needs:
// The interface we use from ember-template-compiler.js
export interface EmberTemplateCompiler {
precompile(templateString: string, options: PreprocessOptions): string;
_buildCompileOptions(options: PreprocessOptions): PreprocessOptions;
_print(ast: ASTv1.Template, options?: { entityEncoding?: 'transformed' | 'raw' }): string;
_preprocess(src: string, options?: PreprocessOptions): ASTv1.Template;
}
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 @ember/application
export.
I'm confused... how can I remove it if I need it?
it looks like you don't need app.import
if you did importSync
to get the real file before
🐞 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