Skip to content
Open
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
15 changes: 15 additions & 0 deletions config/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const fs = require('fs');
const path = require('path');

/*
* babel.config.js
*
Expand All @@ -11,6 +14,15 @@ module.exports = function(api) {

api.cache(() => env + es5Standalone);

// Load an array of plugins from enact property in package.json
const packageFile = path.join(process.cwd(), 'package.json');
const packageContent = fs.existsSync(packageFile) ? JSON.parse(fs.readFileSync(packageFile)) : null;

const babelrcPlugins =
packageContent && packageContent.enact && packageContent.enact.babel_plugins
? packageContent.enact.babel_plugins
: [];

return {
presets: [
[
Expand Down Expand Up @@ -50,6 +62,9 @@ module.exports = function(api) {
['@babel/preset-typescript']
],
plugins: [
// Add external plugins using spread operator
...babelrcPlugins,

// Stage 0
// '@babel/plugin-proposal-function-bind',

Expand Down