mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 19:24:16 +00:00
build: add files of vant-cli 2
This commit is contained in:
14
packages/vant-cli/src/compiler/compile-js.ts
Normal file
14
packages/vant-cli/src/compiler/compile-js.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { transformFileSync } from '@babel/core';
|
||||
import { removeSync, outputFileSync } from 'fs-extra';
|
||||
import { replaceExt } from '../common';
|
||||
|
||||
export function compileJs(filePath: string) {
|
||||
const result = transformFileSync(filePath);
|
||||
|
||||
if (result) {
|
||||
const jsFilePath = replaceExt(filePath, '.js');
|
||||
|
||||
removeSync(filePath);
|
||||
outputFileSync(jsFilePath, result.code);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user