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

Bug in merged source maps #86

Open
goto-bus-stop opened this issue Mar 26, 2018 · 3 comments
Open

Bug in merged source maps #86

goto-bus-stop opened this issue Mar 26, 2018 · 3 comments

Comments

@goto-bus-stop
Copy link
Member

Via @blackgate:

Sure:

const fs = require("fs");
const browserify = require("browserify");
browserify("./script.js", { debug: true })
  .transform("babelify", {presets: ["env"], sourceMaps: true})
  .transform("brfs")
  .bundle()
  .pipe(fs.createWriteStream("bundle.js"));

With the .transform("brfs") line, the sourcemap contains the transpiled source instead of the original.

@goto-bus-stop
Copy link
Member Author

goto-bus-stop commented Mar 30, 2018

@blackgate I'm having trouble reproducing this issue with the latest browserify/babelify/brfs versions.

//script.js
const fs = require('fs')

fs.readFile(__filename, 'utf8', (err, res) => {
    if (err) console.error(err)
    alert(res)
})
// build.js
const fs = require("fs");
const browserify = require("browserify");
browserify("./script.js", { debug: true })
  .transform("babelify", {presets: ["env"], sourceMaps: true})
  .transform("brfs")
  .bundle()
  .pipe(fs.createWriteStream("bundle.js"));

This gives me a bundle.js with the correct source contents:

image

(left is bundle.js, right is source contents)

Which versions are you using? Or could you make a smallish source file that does reproduce the issue?

@goto-bus-stop
Copy link
Member Author

I did find and fix another issue here: browserify/static-module#44
But I believe it's different (it doesn't involve the source contents, only mappings)

@blackgate
Copy link

blackgate commented Apr 3, 2018

@goto-bus-stop Sorry, I just had time to check this out today. The problem only seems to happen on files that don't have a require("fs").

sourcemap

the script.js file is just

import a from './a';

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

No branches or pull requests

2 participants