Open d9k opened 6 years ago
I'm getting error:
Error: Source map to be applied is missing the "file" property
at assertProperty (/home/myuser/myproject/node_modules/vinyl-sourcemaps-apply/index.js:36:13)
at applySourceMap (/home/myuser/myproject/node_modules/vinyl-sourcemaps-apply/index.js:15:3)
at DestroyableTransform.transform [as _transform] (/home/myuser/myproject/node_modules/gulp-coffee/index.js:41:7)
at DestroyableTransform.Transform._read (/home/myuser/myproject/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.
js:184:10)
My gulp task:
var gulp = require('gulp'),
coffee = require('gulp-coffee'),
sourcemaps = require('gulp-sourcemaps');
gulp.task('coffee', function(){
gulp.src(config.coffeePath + '/**/*.coffee')
.pipe(sourcemaps.init())
.pipe(coffee({
bare: true,
transpile: {
presets: [
// Without any configuration options, babel-preset-env behaves exactly the same as babel-preset-latest (or babel-preset-es2015, babel-preset-es2016, and babel-preset-es2017 together).
'env',
],
plugins: [
["transform-react-jsx"]
],
}
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./static/js'));
});
I'm experiencing the same problem. Any progress on this?
Does adding sourceMap: true, inlineMap: true
to the options work? I think they changed this recently - if that fixes it I will update the module.
Hi contra, Thanks for the reply. I tried it with following options, but the result is the same.
{transpile: {presets: ['env']}, sourceMap: true, inlineMap: true}
just got the same problem, any one could help?
➕ 1️⃣
Couple of pointers to help you all:
i guess my issue was more with just being able to transpile at all... gulp-coffee doesn't support the coffeescript's transpile feature. also, i was unable to get sourcemaps to work with gulp 4... i had to still use the gulp-sourcemaps plugin. i currently don't have my project in a state to test it ATM, but would be good to hear someone confirm it is actually working...
You can use gulp-babel
instead of coffeescript transpile option.
Example:
var gulp = require('gulp');
var babel = require('gulp-babel');
var coffee = require('gulp-coffee');
gulp.task('coffee', function() {
gulp.src('./src/*.coffee', { sourcemaps: true })
.pipe(coffee({bare: true}))
.pipe(babel({presets: ['@babel/preset-env']}))
.pipe(gulp.dest('./public/', { sourcemaps: true })); // change to , { sourcemaps: '.' } to generate external sourcemaps
});
The transpile option should work, but it does not at the moment.
Please include configuration examples to README.md