forkTSCheckerPlugin.js 476 Bytes
Newer Older
邓晓峰's avatar
邓晓峰 committed
1 2 3 4 5 6 7 8 9 10 11
const ForkTSCheckerPlugin = require('../compiled/fork-ts-checker-webpack-plugin');

module.exports = async function addForkTSCheckerPlugin(opts) {
  const { config, userConfig } = opts;
  if (userConfig.forkTSChecker) {
    if (userConfig.forkTSChecker.typescript?.enable) {
      userConfig.forkTSChecker.typescript.typescriptPath = require.resolve('typescript');
    }
    config.plugin('fork-ts-checker-plugin').use(ForkTSCheckerPlugin, [userConfig.forkTSChecker]);
  }
};