Skip to content

Bug: SyntaxError with embedded javascript #14

@derrickb

Description

@derrickb

Console text: Uncaught SyntaxError: Invalid or unexpected token

Using alive-server 1.3.0 with Chrome 134.0.6998.166 on macOS 12.7.6, I build my app two ways:

  • dev: vendor/libraries are in a file libraries.js and loaded via <script src="./libraries.js"></script>. This works just fine in alive-server.

  • prod: contents of libraries.js are embedded into index.html in a <script> block. This causes the SyntaxError in Chrome.

Here is a section of the code containing the error:

else if (key === 'innerHTML' &&
              isSVG(elm.tagName) &&
              isUndef(elm.innerHTML)) {
              // IE doesn't support innerHTML for SVG elements
              svgContainer = svgContainer || document.createElement('div');
              svgContainer.innerHTML = "<svg>".concat(cur, "<!-- Code injected by live-server -->
<script type="text/javascript">
	// <![CDATA[  <-- For SVG support
	if ('WebSocket' in window) {
		(function() {
			function refreshCSS() {

The error is occurring at "<!-- Code injected by live-server -->. Please let me know if you need more information to help narrow down the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions