mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 19:24:16 +00:00
feat(cli): add cache-loader
This commit is contained in:
@@ -26,6 +26,7 @@ export const WEBPACK_CONFIG_FILE = join(ROOT, 'webpack.config.js');
|
||||
|
||||
export const DIST_DIR = join(__dirname, '../../dist');
|
||||
export const CONFIG_DIR = join(__dirname, '../config');
|
||||
export const CACHE_DIR = join(ROOT, 'node_modules/.cache');
|
||||
|
||||
export const PACKAGE_ENTRY_FILE = join(DIST_DIR, 'package-entry.js');
|
||||
export const PACKAGE_STYLE_FILE = join(DIST_DIR, 'package-style.css');
|
||||
|
@@ -3,11 +3,19 @@ import FriendlyErrorsPlugin from '@nuxt/friendly-errors-webpack-plugin';
|
||||
import sass from 'sass';
|
||||
import { VueLoaderPlugin } from 'vue-loader';
|
||||
import {
|
||||
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',
|
||||
@@ -31,6 +39,7 @@ export const baseConfig = {
|
||||
{
|
||||
test: /\.vue$/,
|
||||
use: [
|
||||
CACHE_LOADER,
|
||||
{
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
@@ -44,9 +53,7 @@ export const baseConfig = {
|
||||
{
|
||||
test: /\.(js|ts|jsx|tsx)$/,
|
||||
exclude: /node_modules\/(?!(@vant\/cli))/,
|
||||
use: {
|
||||
loader: 'babel-loader'
|
||||
}
|
||||
use: [CACHE_LOADER, 'babel-loader']
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
@@ -56,12 +63,7 @@ export const baseConfig = {
|
||||
{
|
||||
test: /\.less$/,
|
||||
sideEffects: true,
|
||||
use: [
|
||||
...CSS_LOADERS,
|
||||
{
|
||||
loader: 'less-loader'
|
||||
}
|
||||
]
|
||||
use: [...CSS_LOADERS, 'less-loader']
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
@@ -78,7 +80,7 @@ export const baseConfig = {
|
||||
},
|
||||
{
|
||||
test: /\.md$/,
|
||||
use: ['vue-loader', '@vant/markdown-loader']
|
||||
use: [CACHE_LOADER, 'vue-loader', '@vant/markdown-loader']
|
||||
}
|
||||
]
|
||||
},
|
||||
|
Reference in New Issue
Block a user