Skip to content

Commit

Permalink
added babel-plugin-ember-template-compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
candunaj committed Mar 23, 2023
1 parent a0a29b2 commit 72b5850
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions packages/ember-auto-import/ts/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,28 +515,45 @@ export default class Package {
let templateCompilerPath: string = (emberSource as any).absolutePaths
.templateCompiler;

const babelPluginPrecompile = ensureModuleApiPolyfill ?
[
require.resolve('babel-plugin-htmlbars-inline-precompile'),
{
ensureModuleApiPolyfill,
templateCompilerPath,
modules: {
'ember-cli-htmlbars': 'hbs',
'@ember/template-compilation': {
export: 'precompileTemplate',
disableTemplateLiteral: true,
shouldParseScope: true,
isProduction: process.env.EMBER_ENV === 'production',
},
},
},
] :
[
require.resolve('babel-plugin-ember-template-compilation'),
{
// As above, we present the AST transforms in reverse order
// transforms: [...pluginInfo.plugins].reverse(),
compilerPath: require.resolve(templateCompilerPath),
enableLegacyModules: [
'ember-cli-htmlbars',
'ember-cli-htmlbars-inline-precompile',
'htmlbars-inline-precompile',
],
},
'ember-cli-htmlbars:inline-precompile',
];

let plugins = [
[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
[
require.resolve('@babel/plugin-proposal-class-properties'),
{ loose: false },
],
[
require.resolve('babel-plugin-htmlbars-inline-precompile'),
{
ensureModuleApiPolyfill,
templateCompilerPath,
modules: {
'ember-cli-htmlbars': 'hbs',
'@ember/template-compilation': {
export: 'precompileTemplate',
disableTemplateLiteral: true,
shouldParseScope: true,
isProduction: process.env.EMBER_ENV === 'production',
},
},
},
],
babelPluginPrecompile,
...macrosConfig.babelPluginConfig(),
];

Expand Down

0 comments on commit 72b5850

Please sign in to comment.