Skip to content

Commit

Permalink
Merge pull request #573 from candunaj/added-babel-plugin-ember-templa…
Browse files Browse the repository at this point in the history
…te-compilation

added babel-plugin-ember-template-compilation
  • Loading branch information
ef4 authored Apr 3, 2023
2 parents 22ffabc + 4567850 commit cdb8c02
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 cdb8c02

Please sign in to comment.