You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(function () {
$18334e130dafe2913541baf4ea7ba145$exports = "<!-- this is sum html-->\n <h1>Hi I'm HTML</h1>\n";
console.log($18334e130dafe2913541baf4ea7ba145$exports);
})();
As you can see this will throw an error in strict mode and therefore is a bug. It happens when doing this: export * as template from "bundle-text:./html.html";
Please see the attached .zip file and don't forget to fix #5755
🤔 Expected Behavior
console.log("<h1>Hi I'm HTML</h1>");
([the function that takes an argument and returns the argument.default or the argument] wrapped around the string is also acceptable, I think it's called interopDefault)
😯 Current Behavior
Parcel gets confused and forgets to declare the variable with const.
💁 Possible Solution
Put const before $18334e130dafe2913541baf4ea7ba145$exports
🔦 Context
Coworker wanted to show me how to import things without writing
import template_html from "bundle-text:./html.html
export const template = template_html
I didn't believe him it would work and I was kind of right. (I mean it does but not in strict mode and terser doesn't mangle the variable name)
🐛 bug report
Output with
--no-optimize
:Optimized output:
As you can see this will throw an error in strict mode and therefore is a bug. It happens when doing this:
export * as template from "bundle-text:./html.html";
🎛 Configuration (.babelrc, package.json, cli command)
Please see the attached .zip file and don't forget to fix #5755
🤔 Expected Behavior
console.log("<h1>Hi I'm HTML</h1>");
([the function that takes an argument and returns the argument.default or the argument] wrapped around the string is also acceptable, I think it's called interopDefault)
😯 Current Behavior
Parcel gets confused and forgets to declare the variable with
const
.💁 Possible Solution
Put
const
before$18334e130dafe2913541baf4ea7ba145$exports
🔦 Context
Coworker wanted to show me how to import things without writing
I didn't believe him it would work and I was kind of right. (I mean it does but not in strict mode and terser doesn't mangle the variable name)
💻 Code Sample
parcel-doesnt-declare-its-variables.zip
🌍 Your Environment
The text was updated successfully, but these errors were encountered: