chore: remove friendly-errors-webpack-plugin
This commit is contained in:
@@ -39,12 +39,12 @@ export const CONFIG_DIR = join(__dirname, '../config');
|
||||
// Dist files
|
||||
export const PACKAGE_ENTRY_FILE = join(DIST_DIR, 'package-entry.js');
|
||||
export const PACKAGE_STYLE_FILE = join(DIST_DIR, 'package-style.css');
|
||||
export const SITE_MODILE_SHARED_FILE = join(DIST_DIR, 'site-mobile-shared.js');
|
||||
export const SITE_MOBILE_SHARED_FILE = join(DIST_DIR, 'site-mobile-shared.js');
|
||||
export const SITE_DESKTOP_SHARED_FILE = join(
|
||||
DIST_DIR,
|
||||
'site-desktop-shared.js'
|
||||
);
|
||||
export const STYPE_DEPS_JSON_FILE = join(DIST_DIR, 'style-deps.json');
|
||||
export const STYLE_DEPS_JSON_FILE = join(DIST_DIR, 'style-deps.json');
|
||||
|
||||
// Config files
|
||||
export const BABEL_CONFIG_FILE = join(CONFIG_DIR, 'babel.config.js');
|
||||
|
||||
@@ -11,11 +11,11 @@ import {
|
||||
ES_DIR,
|
||||
SRC_DIR,
|
||||
LIB_DIR,
|
||||
STYPE_DEPS_JSON_FILE,
|
||||
STYLE_DEPS_JSON_FILE,
|
||||
} from '../common/constant';
|
||||
|
||||
function getDeps(component: string): string[] {
|
||||
const styleDepsJson = require(STYPE_DEPS_JSON_FILE);
|
||||
const styleDepsJson = require(STYLE_DEPS_JSON_FILE);
|
||||
|
||||
if (styleDepsJson.map[component]) {
|
||||
const deps = styleDepsJson.map[component].slice(0);
|
||||
@@ -57,7 +57,7 @@ function genEntry(params: {
|
||||
}) {
|
||||
const { ext, filename, component, baseFile } = params;
|
||||
const deps = getDeps(component);
|
||||
const depsPath = deps.map(dep => getRelativePath(component, dep, ext));
|
||||
const depsPath = deps.map((dep) => getRelativePath(component, dep, ext));
|
||||
|
||||
OUTPUT_CONFIG.forEach(({ dir, template }) => {
|
||||
const outputDir = join(dir, component, 'style');
|
||||
@@ -81,13 +81,13 @@ export function genComponentStyle(
|
||||
options: { cache: boolean } = { cache: true }
|
||||
) {
|
||||
if (!options.cache) {
|
||||
delete require.cache[STYPE_DEPS_JSON_FILE];
|
||||
delete require.cache[STYLE_DEPS_JSON_FILE];
|
||||
}
|
||||
|
||||
const components = getComponents();
|
||||
const baseFile = getCssBaseFile();
|
||||
|
||||
components.forEach(component => {
|
||||
components.forEach((component) => {
|
||||
genEntry({
|
||||
baseFile,
|
||||
component,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { join } from 'path';
|
||||
import { existsSync } from 'fs-extra';
|
||||
import { smartOutputFile, normalizePath } from '../common';
|
||||
import { CSS_LANG, getCssBaseFile } from '../common/css';
|
||||
import { SRC_DIR, STYPE_DEPS_JSON_FILE } from '../common/constant';
|
||||
import { SRC_DIR, STYLE_DEPS_JSON_FILE } from '../common/constant';
|
||||
|
||||
type Options = {
|
||||
outputPath: string;
|
||||
@@ -10,7 +10,7 @@ type Options = {
|
||||
};
|
||||
|
||||
export function genPackageStyle(options: Options) {
|
||||
const styleDepsJson = require(STYPE_DEPS_JSON_FILE);
|
||||
const styleDepsJson = require(STYLE_DEPS_JSON_FILE);
|
||||
const ext = '.' + CSS_LANG;
|
||||
|
||||
let content = '';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CSS_LANG } from '../common/css';
|
||||
import { existsSync } from 'fs-extra';
|
||||
import { getDeps, clearDepsCache, fillExt } from './get-deps';
|
||||
import { getComponents, smartOutputFile } from '../common';
|
||||
import { SRC_DIR, STYPE_DEPS_JSON_FILE } from '../common/constant';
|
||||
import { SRC_DIR, STYLE_DEPS_JSON_FILE } from '../common/constant';
|
||||
|
||||
function matchPath(path: string, component: string): boolean {
|
||||
const p = relative(SRC_DIR, path);
|
||||
@@ -28,15 +28,15 @@ function analyzeComponentDeps(components: string[], component: string) {
|
||||
function search(filePath: string) {
|
||||
record.add(filePath);
|
||||
|
||||
getDeps(filePath).forEach(key => {
|
||||
getDeps(filePath).forEach((key) => {
|
||||
if (record.has(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
search(key);
|
||||
components
|
||||
.filter(item => matchPath(key, item))
|
||||
.forEach(item => {
|
||||
.filter((item) => matchPath(key, item))
|
||||
.forEach((item) => {
|
||||
if (!checkList.includes(item) && item !== component) {
|
||||
checkList.push(item);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ function getSequence(components: string[], depsMap: DepsMap) {
|
||||
return;
|
||||
}
|
||||
|
||||
const maxIndex = Math.max(...deps.map(dep => sequence.indexOf(dep)));
|
||||
const maxIndex = Math.max(...deps.map((dep) => sequence.indexOf(dep)));
|
||||
|
||||
sequence.splice(maxIndex + 1, 0, item);
|
||||
}
|
||||
@@ -93,25 +93,25 @@ function getSequence(components: string[], depsMap: DepsMap) {
|
||||
export async function genStyleDepsMap() {
|
||||
const components = getComponents();
|
||||
|
||||
return new Promise<void>(resolve => {
|
||||
return new Promise<void>((resolve) => {
|
||||
clearDepsCache();
|
||||
|
||||
const map = {} as DepsMap;
|
||||
|
||||
components.forEach(component => {
|
||||
components.forEach((component) => {
|
||||
map[component] = analyzeComponentDeps(components, component);
|
||||
});
|
||||
|
||||
const sequence = getSequence(components, map);
|
||||
|
||||
Object.keys(map).forEach(key => {
|
||||
Object.keys(map).forEach((key) => {
|
||||
map[key] = map[key].sort(
|
||||
(a, b) => sequence.indexOf(a) - sequence.indexOf(b)
|
||||
);
|
||||
});
|
||||
|
||||
smartOutputFile(
|
||||
STYPE_DEPS_JSON_FILE,
|
||||
STYLE_DEPS_JSON_FILE,
|
||||
JSON.stringify({ map, sequence }, null, 2)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sass from 'sass';
|
||||
import webpack from 'webpack';
|
||||
import FriendlyErrorsPlugin from '@nuxt/friendly-errors-webpack-plugin';
|
||||
import { VueLoaderPlugin } from 'vue-loader';
|
||||
import { join } from 'path';
|
||||
import { consola } from '../common/logger';
|
||||
@@ -39,10 +38,6 @@ const plugins = [
|
||||
__VUE_PROD_DEVTOOLS__: 'false',
|
||||
}),
|
||||
new VueLoaderPlugin(),
|
||||
new FriendlyErrorsPlugin({
|
||||
clearConsole: false,
|
||||
logLevel: 'WARNING',
|
||||
}),
|
||||
];
|
||||
|
||||
const tsconfigPath = join(CWD, 'tsconfig.json');
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getVantConfig, getWebpackConfig } from '../common';
|
||||
import { VantCliSitePlugin } from '../compiler/vant-cli-site-plugin';
|
||||
import {
|
||||
GREEN,
|
||||
SITE_MODILE_SHARED_FILE,
|
||||
SITE_MOBILE_SHARED_FILE,
|
||||
SITE_DESKTOP_SHARED_FILE,
|
||||
} from '../common/constant';
|
||||
|
||||
@@ -48,7 +48,6 @@ export function getSiteDevBaseConfig(): WebpackConfig {
|
||||
},
|
||||
devServer: {
|
||||
port: 8080,
|
||||
quiet: true,
|
||||
host: '0.0.0.0',
|
||||
stats: 'errors-only',
|
||||
publicPath: '/',
|
||||
@@ -56,7 +55,7 @@ export function getSiteDevBaseConfig(): WebpackConfig {
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'site-mobile-shared': SITE_MODILE_SHARED_FILE,
|
||||
'site-mobile-shared': SITE_MOBILE_SHARED_FILE,
|
||||
'site-desktop-shared': SITE_DESKTOP_SHARED_FILE,
|
||||
},
|
||||
},
|
||||
|
||||
Vendored
-1
@@ -10,4 +10,3 @@ declare module 'html-webpack-plugin';
|
||||
declare module 'conventional-changelog';
|
||||
declare module '@vant/markdown-vetur';
|
||||
declare module '@babel/helper-plugin-utils';
|
||||
declare module '@nuxt/friendly-errors-webpack-plugin';
|
||||
|
||||
Reference in New Issue
Block a user