 isPreact = (data) ->
   typeof data == 'object' and data?.type? and data.props?
 renderPreact = (data) ->
-  require('preact-render-to-string') data
+  (window?.preactRenderToString?.default ? require('preact-render-to-string')) \
+    data
 
 $static = Symbol 'svgtiler.static'
 wrapStatic = (x) -> [$static]: x  # exported as `static` but that's reserved

          indent + ' '.repeat(col-1) + '^^^' +
          (if line < lines.length then '\n' + indent + lines[line] else '')
        console.error "SVG parse #{level} in tile '#{@key}': #{msg}"
    .parseFromString @svg, 'image/svg+xml'
    ## Remove from the symbol any top-level xmlns=SVGNS or xmlns:xlink,
    ## in the original parsed content or possibly added above,
    ## to avoid conflict with these attributes in the top-level <svg>.

          ## Include new <symbol> in SVG
          unless found?
            tile.setId @id key unless tile.id?  # unrecognizedTile has id
            svg.appendChild tile.makeXML().documentElement
            if symbolIds.has tile.id
              console.warn "Multiple symbols with id '#{tile.id}': This shouldn't happen, and SVG likely won't load correctly."
            else
