ForkTsCheckerWarningWebpackPlugin
This commit is contained in:
parent
e92ed95ee8
commit
d98146b5ff
|
|
@ -11,7 +11,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const ForkTsCheckerWebpackPlugin =
|
||||
process.env.TSC_COMPILE_ON_ERROR === 'true'
|
||||
? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
|
||||
? require('./../../plugins/ForkTsCheckerWarningWebpackPlugin')
|
||||
: require('react-dev-utils/ForkTsCheckerWebpackPlugin');
|
||||
const OakWeChatMpPlugin = require('../../plugins/WechatMpPlugin');
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const getClientEnvironment = require('./env');
|
|||
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
|
||||
const ForkTsCheckerWebpackPlugin =
|
||||
process.env.TSC_COMPILE_ON_ERROR === 'true'
|
||||
? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
|
||||
? require('./../../plugins/ForkTsCheckerWarningWebpackPlugin')
|
||||
: require('react-dev-utils/ForkTsCheckerWebpackPlugin');
|
||||
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
||||
|
||||
|
|
@ -681,9 +681,7 @@ module.exports = function (webpackEnv) {
|
|||
javascriptEnabled: true,
|
||||
modifyVars: oakConfigJson.theme,
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// References:
|
||||
// - https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#plugin-hooks
|
||||
// - https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/232#issuecomment-645543747
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
|
||||
module.exports = class ForkTsCheckerWarningWebpackPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
apply(compiler) {
|
||||
new ForkTsCheckerWebpackPlugin(this.options).apply(compiler);
|
||||
|
||||
const hooks = ForkTsCheckerWebpackPlugin.getCompilerHooks(compiler);
|
||||
|
||||
hooks.issues.tap('ForkTsCheckerWarningWebpackPlugin', issues =>
|
||||
issues.map(issue => ({ ...issue, severity: 'warning' }))
|
||||
);
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue