diff --git a/babel.config.js b/babel.config.js index 377445d9dcea82bfe5a2588d5eae41ee28ee1d5f..7bbdf6b82c06117cc9fae08b0bfc494b294c563b 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,9 +1,8 @@ module.exports = function (api) { api.cache(true) - const isBrowser = process.env.BABEL_ENV === 'browser' const presets = [] const plugins = [] - if (isBrowser) { + if (process.env.BABEL_ENV === 'browser') { presets.push([ // https://babeljs.io/docs/en/babel-preset-env '@babel/preset-env', @@ -21,7 +20,7 @@ module.exports = function (api) { plugins.push('@babel/plugin-proposal-class-properties') plugins.push('@babel/plugin-transform-runtime') } - if (!isBrowser) { + if (process.env.BABEL_ENV === 'node') { presets.push([ '@babel/preset-env', { @@ -31,6 +30,10 @@ module.exports = function (api) { } ]) } + // for JavaScript Standard Style library to support JSX syntax + if (process.env.BABEL_ENV === undefined) { + presets.push('@babel/preset-react') + } return { presets,