-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from embroider-build/babel
update to user-controlled babel file
- Loading branch information
Showing
1 changed file
with
38 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}; |