vant/packages/vant-cli/cjs/babel.config.cjs
2021-11-10 10:34:42 +08:00

31 lines
664 B
JavaScript

module.exports = function (api, options) {
if (api) {
api.cache.never();
}
const { BABEL_MODULE, NODE_ENV } = process.env;
const isTest = NODE_ENV === 'test';
const useESModules = BABEL_MODULE !== 'commonjs' && !isTest;
return {
presets: [
[
require.resolve('@babel/preset-env'),
{
modules: useESModules ? false : 'commonjs',
loose: options.loose,
},
],
require.resolve('@babel/preset-typescript'),
],
plugins: [
[
require.resolve('@vue/babel-plugin-jsx'),
{
enableObjectSlots: options.enableObjectSlots,
},
],
],
};
};