mirror of
https://github.com/youzan/vant.git
synced 2025-10-17 08:37:23 +00:00
feat(cli): bump webpack@5
This commit is contained in:
@@ -47,7 +47,6 @@
|
||||
"@babel/preset-typescript": "^7.10.1",
|
||||
"@nuxt/friendly-errors-webpack-plugin": "^2.5.0",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/webpack": "^4.41.13",
|
||||
"@types/webpack-dev-server": "^3.11.0",
|
||||
"@vant/eslint-config": "^3.0.0-alpha.2",
|
||||
"@vant/markdown-loader": "^3.0.0-alpha.0",
|
||||
@@ -62,7 +61,6 @@
|
||||
"babel-jest": "^26.0.1",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-plugin-import": "^1.13.0",
|
||||
"cache-loader": "^4.1.0",
|
||||
"chokidar": "^3.4.0",
|
||||
"clean-css": "^4.2.3",
|
||||
"codecov": "^3.7.0",
|
||||
@@ -76,7 +74,7 @@
|
||||
"fork-ts-checker-webpack-plugin": "^5.0.0",
|
||||
"gh-pages": "^3.0.0",
|
||||
"hash-sum": "^2.0.0",
|
||||
"html-webpack-plugin": "4.3.0",
|
||||
"html-webpack-plugin": "4.5.0",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.0.0",
|
||||
"jest-canvas-mock": "^2.2.0",
|
||||
@@ -100,7 +98,7 @@
|
||||
"vue-jest": "^5.0.0-alpha.4",
|
||||
"vue-loader": "^16.0.0-beta.7",
|
||||
"vue-router": "^4.0.0-beta.13",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack": "^5.0.0",
|
||||
"webpack-dev-server": "3.11.0",
|
||||
"webpack-merge": "^5.0.0",
|
||||
"webpackbar": "^4.0.0"
|
||||
|
@@ -6,7 +6,7 @@ export async function compilePackage(isMinify: boolean) {
|
||||
const config = getPackageConfig(isMinify);
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
if (err || stats.hasErrors()) {
|
||||
if (err || (stats && stats.hasErrors())) {
|
||||
reject();
|
||||
} else {
|
||||
resolve();
|
||||
|
@@ -24,7 +24,7 @@ function runDevServer(
|
||||
const server = new WebpackDevServer(webpack(config), config.devServer);
|
||||
|
||||
// this is a hack to disable wds status log
|
||||
(server as any).showStatus = function() {};
|
||||
(server as any).showStatus = function () {};
|
||||
|
||||
const host = get(config.devServer, 'host', 'localhost');
|
||||
server.listen(port, host, (err?: Error) => {
|
||||
@@ -58,7 +58,7 @@ function build() {
|
||||
const config = getSitePrdConfig();
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
if (err || stats.hasErrors()) {
|
||||
if (err || (stats && stats.hasErrors())) {
|
||||
reject();
|
||||
} else {
|
||||
resolve();
|
||||
|
@@ -10,7 +10,7 @@ import { PACKAGE_ENTRY_FILE, PACKAGE_STYLE_FILE } from '../common/constant';
|
||||
|
||||
const PLUGIN_NAME = 'VantCliSitePlugin';
|
||||
|
||||
export async function genSiteEntry() {
|
||||
export async function genSiteEntry(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
genStyleDepsMap()
|
||||
.then(() => {
|
||||
@@ -24,7 +24,7 @@ export async function genSiteEntry() {
|
||||
genSiteDesktopShared();
|
||||
resolve();
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
});
|
||||
|
@@ -8,19 +8,11 @@ import { existsSync } from 'fs';
|
||||
import { WebpackConfig } from '../common/types';
|
||||
import {
|
||||
CWD,
|
||||
CACHE_DIR,
|
||||
STYLE_EXTS,
|
||||
SCRIPT_EXTS,
|
||||
POSTCSS_CONFIG_FILE,
|
||||
} from '../common/constant';
|
||||
|
||||
const CACHE_LOADER = {
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: CACHE_DIR,
|
||||
},
|
||||
};
|
||||
|
||||
const CSS_LOADERS = [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
@@ -85,7 +77,6 @@ export const baseConfig: WebpackConfig = {
|
||||
{
|
||||
test: /\.vue$/,
|
||||
use: [
|
||||
CACHE_LOADER,
|
||||
{
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
@@ -99,7 +90,7 @@ export const baseConfig: WebpackConfig = {
|
||||
{
|
||||
test: /\.(js|ts|jsx|tsx)$/,
|
||||
exclude: /node_modules\/(?!(@vant\/cli))/,
|
||||
use: [CACHE_LOADER, 'babel-loader'],
|
||||
use: ['babel-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
@@ -126,9 +117,15 @@ export const baseConfig: WebpackConfig = {
|
||||
},
|
||||
{
|
||||
test: /\.md$/,
|
||||
use: [CACHE_LOADER, '@vant/markdown-loader'],
|
||||
use: ['@vant/markdown-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins,
|
||||
cache: {
|
||||
type: 'filesystem',
|
||||
buildDependencies: {
|
||||
config: [__filename],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user