Skip to content

Commit bb67961

Browse files
committed
fix(gulp): use different transpile options for server and client
for Grunt parity, the server code should be transpiled with with the `runtime` option
1 parent 4a5e02b commit bb67961

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: app/templates/gulpfile.babel(gulp).js

+12-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,15 @@ let styles = lazypipe()
137137
.pipe(plugins.autoprefixer, {browsers: ['last 1 version']})
138138
.pipe(plugins.sourcemaps.write, '.');<% if(filters.babel || filters.coffee) { %>
139139

140-
let transpile = lazypipe()
140+
let transpileServer = lazypipe()
141+
.pipe(plugins.sourcemaps.init)<% if(filters.babel) { %>
142+
.pipe(plugins.babel, {
143+
optional: ['runtime']
144+
})<% } else { %>
145+
.pipe(plugins.coffee, {bare: true})<% } %>
146+
.pipe(plugins.sourcemaps.write, '.');
147+
148+
let transpileClient = lazypipe()
141149
.pipe(plugins.sourcemaps.init)<% if(filters.babel) { %>
142150
.pipe(plugins.babel, {
143151
optional: ['es7.classProperties']
@@ -255,13 +263,13 @@ gulp.task('styles', () => {
255263

256264
gulp.task('transpile:client', () => {
257265
return gulp.src(paths.client.scripts)
258-
.pipe(transpile())
266+
.pipe(transpileClient())
259267
.pipe(gulp.dest('.tmp'));
260268
});<% } %>
261269

262270
gulp.task('transpile:server', () => {
263271
return gulp.src(_.union(paths.server.scripts, paths.server.json))
264-
.pipe(transpile())
272+
.pipe(transpileServer())
265273
.pipe(gulp.dest(`${paths.dist}/${serverPath}`));
266274
});
267275

@@ -335,7 +343,7 @@ gulp.task('watch', () => {
335343

336344
plugins.watch(paths.client.scripts) //['inject:js']
337345
.pipe(plugins.plumber())<% if(filters.babel || filters.coffee) { %>
338-
.pipe(transpile())
346+
.pipe(transpileClient())
339347
.pipe(gulp.dest('.tmp'))<% } %>
340348
.pipe(plugins.livereload());
341349

0 commit comments

Comments
 (0)