Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coffeescript 2 with transpile + inlined source maps? #91

Open
d9k opened this issue May 11, 2018 · 9 comments · May be fixed by #97
Open

coffeescript 2 with transpile + inlined source maps? #91

d9k opened this issue May 11, 2018 · 9 comments · May be fixed by #97

Comments

@d9k
Copy link

d9k commented May 11, 2018

Please include configuration examples to README.md

@d9k
Copy link
Author

d9k commented May 11, 2018

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'));
});

@shnam7
Copy link

shnam7 commented Jun 21, 2018

I'm experiencing the same problem. Any progress on this?

@yocontra
Copy link
Member

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.

@shnam7
Copy link

shnam7 commented Jun 21, 2018

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}

@phonowell
Copy link

just got the same problem, any one could help?

@brewster1134
Copy link

➕ 1️⃣

@yocontra
Copy link
Member

yocontra commented Aug 4, 2020

Couple of pointers to help you all:

  • Don't use gulp-sourcemaps directly anymore, sourcemaps are built into gulp 4 so you can just turn on sourcemaps in gulp.src
  • Make sure you read the coffee-script docs on how to enable sourcemaps, then it should play nicely with the gulp sourcemap support

@brewster1134
Copy link

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...

@nitely
Copy link

nitely commented Aug 15, 2020

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.

@nitely nitely linked a pull request Aug 15, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants