route icon indicating copy to clipboard operation
route copied to clipboard

Template literals break IE

Open bonpixel opened this issue 10 years ago • 5 comments

Do you want to request a feature or report a bug? This is a bug

What is the current behavior? The page does not open in ie11. I get an error: Invalid character

What is the expected behavior? No error

IE is breaking when it tries to evaluate the template literal here: https://github.com/riot/route/blob/master/dist/cjs.route.js#L59

Per the MDN it doesn't look like those are supported in IE at all. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

Steps to reproduce: Try to use the router in an application loaded into IE11

bonpixel avatar Dec 02 '16 18:12 bonpixel

Hi @bonpixel, try dist/route.js instead.

dist/cjs.route.js is the file for webpack or browserify. You can't use it in browser directly.

cognitom avatar Dec 02 '16 18:12 cognitom

@cognitom I see what you mean, however, I actually was trying to use riot-route in a browserify context.

When I require('riot-route') in my index file, the cjs.route.js file is what is bundled. This is what I would expect from reading the package.json but I don't understand how are you recommending that I "require" riot-route given I want it in a browserify bundle?

bonpixel avatar Dec 02 '16 18:12 bonpixel

@bonpixel I see. You're right. I didn't care the case without transpilers like babel or buble. Maybe we should transpile it...

cognitom avatar Dec 02 '16 19:12 cognitom

We can simply add buble transpilation here: https://github.com/riot/route/blob/v3.0.1/rollup.js#L20-L23

cognitom avatar Dec 02 '16 19:12 cognitom

OK, now v3.0.2 has been released and dist/cjs.route.js is correctly transpiled. @bonpixel thanks for pointing it out 😉

cognitom avatar Dec 03 '16 08:12 cognitom