Skip to content
代码片段 群组 项目
  • Chaoyue Zhao's avatar
    406c633c
    Changes after rebase: · 406c633c
    Chaoyue Zhao 创作于
    - Remove pdf from webpack.vendor.config
    - Support both versions of pdfjs in webpack.constants.js
    - Pull pdfjs consts into its own file
    - Fix tests
    未验证
    406c633c
    历史
    Changes after rebase:
    Chaoyue Zhao 创作于
    - Remove pdf from webpack.vendor.config
    - Support both versions of pdfjs in webpack.constants.js
    - Pull pdfjs consts into its own file
    - Fix tests
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。
babel.config.js 1.14 KiB
const coreJSVersion = require('./node_modules/core-js/package.json').version;

let presets = [
  [
    '@babel/preset-env',
    {
      useBuiltIns: 'usage',
      bugfixes: true,
      corejs: { version: coreJSVersion, proposals: true },
      modules: false,
    },
  ],
];

// include stage 3 proposals
const plugins = [
  '@babel/plugin-transform-class-properties',
  '@babel/plugin-transform-json-strings',
  '@babel/plugin-transform-private-methods',
  // See: https://gitlab.com/gitlab-org/gitlab/-/issues/229146
  '@babel/plugin-transform-arrow-functions',
  // See: https://gitlab.com/gitlab-org/gitlab/-/issues/336216
  '@babel/plugin-transform-optional-chaining',
  // See: https://gitlab.com/gitlab-org/gitlab/-/issues/336216
  '@babel/plugin-transform-nullish-coalescing-operator',
  'lodash',
  '@babel/plugin-transform-class-static-block',
];

// Jest is running in node environment
const isJest = Boolean(process.env.JEST_WORKER_ID);
if (isJest) {
  presets = [
    [
      '@babel/preset-env',
      {
        targets: {
          node: 'current',
        },
      },
    ],
  ];
}

module.exports = { presets, plugins, sourceType: 'unambiguous' };