diff --git a/build/compiler.js b/build/compiler.js index 6a31e337..0bd9d501 100644 --- a/build/compiler.js +++ b/build/compiler.js @@ -7,7 +7,8 @@ const postcss = require('gulp-postcss'); const util = require('util'); const exec = util.promisify(require('child_process').exec); -const src = path.join(__dirname, '../packages'); +const src = path.resolve(__dirname, '../packages'); +const icons = path.resolve(__dirname, '../node_modules/@vant/icons'); const libConfig = path.resolve(__dirname, '../tsconfig.lib.json'); const esConfig = path.resolve(__dirname, '../tsconfig.json'); @@ -73,6 +74,7 @@ module.exports = { compileTs(exampleConfig, exampleDir), compileLess(exampleDir), copyStatic(exampleDir), + () => gulp.src(`${icons}/**/*`).pipe(gulp.dest(`${exampleDir}/@vant/icons`)), () => { gulp.watch(`${src}/**/*.ts`, compileTs(exampleConfig, exampleDir)); gulp.watch(`${src}/**/*.less`, compileLess(exampleDir)); diff --git a/build/dev.js b/build/dev.js index 9a60123f..d4ec5349 100644 --- a/build/dev.js +++ b/build/dev.js @@ -1,15 +1,10 @@ -const fs = require('fs-extra'); const path = require('path'); const serve = require('webpack-serve'); const config = require('./webpack.doc.dev'); -const dist = path.join(__dirname, '../example/dist'); -const icons = path.join(__dirname, '../node_modules/@vant/icons'); const { exec } = require('child_process'); const gulpConfig = path.resolve(__dirname, './compiler.js'); -fs.copySync(icons, path.join(dist, '/@vant/icons')); - serve({}, { config }); exec(`npx gulp -f ${gulpConfig} buildExample`);