Gulp plugin that allows to use swc javascript / typescript compiler in a gulp pipeline.
npm install gulp-swc @swc/core gulp --save-dev
or
yarn add gulp-swc @swc/core gulp --dev
In your gulpfile.js:
const gulp = require('gulp');
const swc = require('gulp-swc');
// Any options to configure swc: https://swc.rs/docs/configuring-swc
const swcOptions = {
jsc: {
target: 'es5',
},
};
gulp.task('build', () =>
gulp.src('./app.js').pipe(swc(swcOptions)).pipe(gulp.dest('dist')),
);
const gulp = require('gulp');
const swc = require('gulp-swc');
const sourcemaps = require('gulp-sourcemaps');
const concat = require('gulp-concat');
const swcOptions = {
jsc: {
target: 'es5',
},
sourceMaps: true,
};
gulp.task('build', () =>
gulp
.src('./app/**/*.js')
.pipe(sourcemaps.init())
.pipe(swc(swcOptions))
.pipe(concat('app.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist')),
);