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

Disable //# sourceURL= output #1748

Open
jmm opened this issue Feb 18, 2015 · 7 comments
Open

Disable //# sourceURL= output #1748

jmm opened this issue Feb 18, 2015 · 7 comments
Assignees

Comments

@jmm
Copy link

jmm commented Feb 18, 2015

Please disable output of //# sourceURL= comments by default or at least provide an option to disable it. It serves no purpose in many cases and currently causes several problems in Chrome.

Examples:

browserify({
  entries: whatever,
  debug: true,
})
  .transform(es6ify)
  .bundle()
  .pipe(exorcist())

Currently results in broken source mapping due to Chrome's misapplication of sourceURL comments. The comments serve no purpose in this case because the source files are identified by the sources array in the source map.

See http://code.google.com/p/chromium/issues/detail?id=457419

browserify({
  entries: whatever,
  debug: false,
})
  .transform(es6ify)
  .bundle()

Even without source mapping, presence of the sourceURL comments results in mangled line numbers in the debugger due to Chrome's misapplication of them. Again, they serve no purpose here (that I'm aware of).

See http://code.google.com/p/chromium/issues/detail?id=459682

@johnjbarton
Copy link
Contributor

Please post some examples related to traceur.

@jmm
Copy link
Author

jmm commented Feb 20, 2015

2 of 2 examples I posted are related to traceur. I thought you're familiar with es6ify, which uses traceur to transpile. The example could also be transpiling files with traceur and concatenating or browserifying or otherwise bundling the generated files. You can also observe that the output of (new traceur.NodeCompiler).compile(';', 'a', 'b') includes a sourceURL comment.

@johnjbarton
Copy link
Contributor

I want to focus on the issue related to
See http://code.google.com/p/chromium/issues/detail?id=457419
and ensure that sourceURL is not emitted when sourceMappingURL is emitted. But I don't see that in my test case, only sourceMappingURL is emitted when --sourcemaps is used.

@jmm
Copy link
Author

jmm commented Feb 20, 2015

I want to focus on the issue related to
See http://code.google.com/p/chromium/issues/detail?id=457419
and ensure that sourceURL is not emitted when sourceMappingURL is emitted

Let's focus on that for the moment.

(new traceur.NodeCompiler({sourceMaps: 'inline'}))
    .compile(';', 'a', 'b')

emits sourceMappingURL and sourceURL.

@jmm
Copy link
Author

jmm commented Feb 20, 2015

@johnjbarton @arv This issue isn't fully resolved. See # 2. Even without source mapping I don't want my line numbers mangled. It's not traceur's fault, but see # 2 -- these comments often serve no purpose and are causing a real world problem.

@johnjbarton johnjbarton reopened this Feb 20, 2015
@johnjbarton
Copy link
Contributor

As before, a traceur-specific case will help.

If you are compiling using the compile() API, setting the input and output file name the same will suppress the sourceURL.

@jmm
Copy link
Author

jmm commented Feb 20, 2015

As before, a traceur-specific case will help.

Me:

The example could also be transpiling files with traceur and concatenating or browserifying or otherwise bundling the generated files.

Transpiling multiple items of code with traceur and concatenating or bundling the output into a single file in any fashion.

If you are compiling using the compile() API, setting the input and output file name the same will suppress the sourceURL.

I guess when source mapping isn't being used then the outputName value doesn't matter, making that a viable solution. Still, what is the reasoning for generating a sourceURL comment in that case? Those comments would be useful when eval()ing the code or embedding it in a <script> tag right? So the semantics are going to be?:

A) If you're not doing source mapping, will load the generated code with a src attr, and don't want sourceURL comments, you pass the same values for sourceName and outputName.

B) If you're not doing source mapping, will embed the generated code in a <script> element or eval() it, and want sourceURL comments, you pass an empty string or whatever as sourceName and the value you want in the sourceURL comment as outputName.

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.

3 participants