After running it through buble --yes dangerousTaggedTemplateString sourcedir -o targetdir it outputs:
bar
bar
This happens because both transpiled files put the quasis into global variables called templateObject, which then overwrite each other. I think this is what was pointed out on the original PR here: https://github.com/bublejs/buble/pull/67#issuecomment-349340228
In general I would assume that the "compile directory" mode of buble would avoid introducing colliding identifiers in the root scope across all the files. I think using this mode to transpile a bunch of test files for execution in a browser is a very common use case? Maybe the root scope object could just be carried over to the subsequent files so the var would come out as templateObject$1 in the second file?
Given a setup like this:
foo.js
bar.js
index.html
Running the above in a browser outputs:
After running it through
buble --yes dangerousTaggedTemplateString sourcedir -o targetdir
it outputs:This happens because both transpiled files put the quasis into global variables called
templateObject
, which then overwrite each other. I think this is what was pointed out on the original PR here: https://github.com/bublejs/buble/pull/67#issuecomment-349340228In general I would assume that the "compile directory" mode of buble would avoid introducing colliding identifiers in the root scope across all the files. I think using this mode to transpile a bunch of test files for execution in a browser is a very common use case? Maybe the root
scope
object could just be carried over to the subsequent files so the var would come out astemplateObject$1
in the second file?Babel has the same bug btw. :)