mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
31 lines
664 B
JavaScript
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,
|
|
},
|
|
],
|
|
],
|
|
};
|
|
};
|