elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

String literal containing closing script tag makes generated HTML blow up #174

Closed zwilias closed 6 years ago

zwilias commented 7 years ago
foo = "</script>"

Saving that in a file, compiling it to html and opening the result in a browser yields the following output:

'; var Elm = {}; Elm['Main'] = Elm['Main'] || {}; if (typeof _user$project$Main$main !== 'undefined') { _user$project$Main$main(Elm['Main'], 'Main', undefined); } if (typeof define === "function" && define['amd']) { define([], function() { return Elm; }); return; } if (typeof module === "object") { module['exports'] = Elm; return; } var globalElm = this['Elm']; if (typeof globalElm === "undefined") { this['Elm'] = Elm; return; } for (var publicModule in Elm) { if (publicModule in globalElm) { throw new Error('There are two Elm modules called `' + publicModule + '` on this page! Rename one of them.'); } globalElm[publicModule] = Elm[publicModule]; } }).call(this);

More info here: https://stackoverflow.com/questions/1659749/script-tag-in-javascript-string

process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 6 years ago

Tracking over in the compiler. Thanks for the report!