feat(cli): add convention static directory (#8929)

* fix: #8890 sfc compile error

* chore(vant-cli): add convention static directory

* chore(vant-cli): another way to deal with static resources
This commit is contained in:
zoy-l 2021-06-25 17:02:55 +08:00 committed by chenjiahan
parent 6262cdbd67
commit 80f95c4773
2 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import { genVeturConfig } from '../compiler/gen-vetur-config';
import {
isDir,
isSfc,
isAsset,
isStyle,
isScript,
isDemoDir,
@ -39,6 +40,10 @@ async function compileFile(filePath: string) {
return compileStyle(filePath);
}
if (isAsset(filePath)) {
return Promise.resolve();
}
return remove(filePath);
}

View File

@ -14,6 +14,7 @@ export const EXT_REGEXP = /\.\w+$/;
export const SFC_REGEXP = /\.(vue)$/;
export const DEMO_REGEXP = new RegExp('\\' + sep + 'demo$');
export const TEST_REGEXP = new RegExp('\\' + sep + 'test$');
export const ASSET_REGEXP = /\.(png|jpe?g|gif|webp|ico|jfif|svg|woff2?|ttf)$/i;
export const STYLE_REGEXP = /\.(css|less|scss)$/;
export const SCRIPT_REGEXP = /\.(js|ts|jsx|tsx)$/;
export const ENTRY_EXTS = ['js', 'ts', 'tsx', 'jsx', 'vue'];
@ -59,6 +60,10 @@ export function isTestDir(dir: string) {
return TEST_REGEXP.test(dir);
}
export function isAsset(path: string) {
return ASSET_REGEXP.test(path);
}
export function isSfc(path: string) {
return SFC_REGEXP.test(path);
}