react-svg-loader icon indicating copy to clipboard operation
react-svg-loader copied to clipboard

Server side rendering not working

Open artursgirons opened this issue 8 years ago • 12 comments

It feels like when webpack-dev-middleware brakes it all: Unexpected token (1:1)

1 |

artursgirons avatar Sep 21 '16 16:09 artursgirons

Looks like the SVG is not passed via svg-loader.

boopathi avatar Oct 08 '16 14:10 boopathi

Hi @artursgirons I've been searching for server side rendering without loose my mind because just a icon, so I found this

https://medium.com/@david.gilbertson/icons-as-react-components-de3e33cb8792#.3b0493ysm

So, just like it on heart icon and love all this too

@boopathi server side renders was be a great example, but https://github.com/webpack/react-webpack-server-side-example it not goes ahead

brunoguerra avatar Nov 17 '16 12:11 brunoguerra

Hi @artursgirons I think I am running to this same issue.

My node service crashes when I do a browser refresh on the page that imports the svg file but if I load my app on a different page that does not have svg file imported and then proceed to the page that imports the svg, it works totally fine until I refresh the page and spits out the same error you described.

Wondering if you had made any progress on the issue?

jwwlai avatar Mar 29 '17 20:03 jwwlai

It doesn't pass svgo plugins options correctly too:

> 1 | <svg width="73px" height="15px" viewBox="0 0 73 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
      |                                                                                                      ^
    2 |     <title>Powered By - Stacked</title>
    3 |     <desc>Created with Sketch.</desc>
    4 |     <defs>
        {
          test: /\.svg$/,
            loaders: [
            {
              loader: 'babel-loader',
              query: {
                presets: ['es2015']
              }
            },
            {
              loader: 'react-svg-loader',
              query: {
                jsx: true,
                svgo: {
                  plugins: [{removeTitle: false}, {removeXMLNS: true}],
                  floatPrecision: 2
                }
              }
            }
          ]
        }

mrchief avatar Apr 05 '17 14:04 mrchief

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 13 '19 04:02 stale[bot]

Stale bot strikes again!

mrchief avatar Feb 13 '19 16:02 mrchief

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 14 '19 16:04 stale[bot]

Looks like there is no interest in fixing this?

mrchief avatar Apr 14 '19 17:04 mrchief

@artursgirons I'm also running into the same issue.

It is working until I refresh the page, Once I refresh the page node is crashing with error: UnhandledPromiseRejectionWarning: Unhandled promise rejection

voletiswaroop avatar Jun 12 '19 11:06 voletiswaroop

Has anyone had any joy with this at all? I'm still having issues.

karlwills avatar Jul 23 '19 08:07 karlwills

react-svg-loader works when used with Next.js, so I'm not sure how it relates strictly to server-side rendering/hydration.

kylemh avatar Jul 23 '19 22:07 kylemh

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 21 '19 23:09 stale[bot]