@@ -26,6 +26,8 @@ const concat = requireCwd('gulp-concat');
2626const concatCss = requireCwd('gulp-concat-css');
2727const cleanCSS = requireCwd('gulp-clean-css');
2828const through2 = requireCwd('through2');
29+ const replace = requireCwd('gulp-replace-path', true);
30+ const vueSFC = requireCwd('@omni-door/gulp-plugin-vue-sfc', true);
2931
3032const ppkj = requireCwd('./package.json');
3133const configFilePath = (ppkj && ppkj.${ pkjFieldName } && ppkj.${ pkjFieldName } .filePath) || './${ configFileName } ';
@@ -71,6 +73,7 @@ function compileScripts (babelEnv, destDir) {
7173 .pipe(sourcemaps ? sourcemaps.init() : through2.obj())
7274 .pipe(project ? project() : through2.obj())
7375 .pipe(babel({ root: process.cwd() }))
76+ .pipe(replace ? replace(/.vue/g, '.js') : through2.obj())
7477 .pipe(
7578 through2.obj(function (file, encoding, next) {
7679 this.push(file.clone());
@@ -99,10 +102,16 @@ function compileES () {
99102 return compileScripts('es', dest.es);
100103}
101104
102- function copyVueSFC () {
105+ function compileSFC () {
103106 const { dest, vue } = params;
104107 return gulp
105108 .src(vue)
109+ .pipe(sourcemaps ? sourcemaps.init() : through2.obj())
110+ .pipe(vueSFC ? vueSFC.default({ ext: '.ts' }) : through2.obj())
111+ .pipe((alias && project) ? alias({ configuration: project.config }) : through2.obj())
112+ .pipe(project ? project() : through2.obj())
113+ .pipe(babel({ root: process.cwd() }))
114+ .pipe(sourcemaps ? sourcemaps.write({ sourceRoot: file => path.relative(path.join(file.cwd, file.path), file.base) }) : through2.obj())
106115 .pipe(gulp.dest(dest.lib))
107116 .pipe(gulp.dest(dest.es));
108117}
@@ -152,7 +161,7 @@ function trans2css() {
152161 .pipe(gulp.dest(dest.es));
153162}
154163
155- const buildScripts = gulp.series(compileCJS, compileES, copyVueSFC );
164+ const buildScripts = gulp.series(compileCJS, compileES, compileSFC );
156165
157166const builds = ${
158167 configurationPath
0 commit comments