mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 10:07:07 +00:00
feat(cli): enable type checking
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import sass from 'sass';
|
||||
import FriendlyErrorsPlugin from '@nuxt/friendly-errors-webpack-plugin';
|
||||
import { VueLoaderPlugin } from 'vue-loader';
|
||||
import { join } from 'path';
|
||||
import { existsSync } from 'fs';
|
||||
import { consola } from '../common/logger';
|
||||
import {
|
||||
CWD,
|
||||
CACHE_DIR,
|
||||
STYLE_EXTS,
|
||||
SCRIPT_EXTS,
|
||||
@@ -28,6 +32,36 @@ const CSS_LOADERS = [
|
||||
},
|
||||
];
|
||||
|
||||
const plugins = [
|
||||
new VueLoaderPlugin(),
|
||||
new FriendlyErrorsPlugin({
|
||||
clearConsole: false,
|
||||
logLevel: 'WARNING',
|
||||
}),
|
||||
];
|
||||
|
||||
const tsconfigPath = join(CWD, 'tsconfig.json');
|
||||
console.log('tsconfigPath', existsSync(tsconfigPath));
|
||||
if (existsSync(tsconfigPath)) {
|
||||
const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
plugins.push(
|
||||
new ForkTsCheckerPlugin({
|
||||
formatter: 'codeframe',
|
||||
vue: { enabled: true },
|
||||
logger: {
|
||||
// skip info message
|
||||
info() {},
|
||||
warn(message: string) {
|
||||
consola.warn(message);
|
||||
},
|
||||
error(message: string) {
|
||||
consola.error(message);
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export const baseConfig = {
|
||||
mode: 'development',
|
||||
resolve: {
|
||||
@@ -83,11 +117,5 @@ export const baseConfig = {
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new FriendlyErrorsPlugin({
|
||||
clearConsole: false,
|
||||
logLevel: 'WARNING',
|
||||
}),
|
||||
],
|
||||
plugins,
|
||||
};
|
||||
|
Reference in New Issue
Block a user