Skip to content
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

update to user-controlled babel file #68

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
},
};
Loading