Skip to content

Commit

Permalink
Merge pull request #68 from embroider-build/babel
Browse files Browse the repository at this point in the history
update to user-controlled babel file
  • Loading branch information
mansona authored Sep 11, 2024
2 parents 6197822 + 5450922 commit 8998e73
Showing 1 changed file with 38 additions and 15 deletions.
53 changes: 38 additions & 15 deletions files/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
let config;
const {
babelCompatSupport,
templateCompatSupport,
} = require('@embroider/compat/babel');

// TODO - remove this once we have the better solution for injecting stage1 babel config into a real config file
// this is needed because there are things (like ember-composible-helpers) that are now finding our babel config during
// their stage1 build and historically they will never (99% of the time) have found any babel config.
// we might need to keep something like this so that prebuild will never apply babel configs during stage1 i.e. a util
// function that wraps your whole babel config
if (
process.env.EMBROIDER_PREBUILD ||
process.env.EMBROIDER_TEST_SETUP_FORCE === 'classic'
) {
config = {};
} else {
config = require('./node_modules/.embroider/_babel_config_');
}
module.exports = {
plugins: [
[
'babel-plugin-ember-template-compilation',
{
compilerPath: 'ember-source/dist/ember-template-compiler.js',
enableLegacyModules: [
'ember-cli-htmlbars',
'ember-cli-htmlbars-inline-precompile',
'htmlbars-inline-precompile',
],
transforms: [...templateCompatSupport()],
},
],
[
'module:decorator-transforms',
{
runtime: { import: require.resolve('decorator-transforms/runtime') },
},
],
[
'@babel/plugin-transform-runtime',
{
absoluteRuntime: __dirname,
useESModules: true,
regenerator: false,
},
],
...babelCompatSupport(),
],

module.exports = config;
generatorOpts: {
compact: false,
},
};

0 comments on commit 8998e73

Please sign in to comment.