react-svg-loader
react-svg-loader copied to clipboard
Server side rendering not working
It feels like when webpack-dev-middleware brakes it all: Unexpected token (1:1)
1 |
Looks like the SVG is not passed via svg-loader.
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
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?
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
}
}
}
]
}
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 strikes again!
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.
Looks like there is no interest in fixing this?
@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
Has anyone had any joy with this at all? I'm still having issues.
react-svg-loader
works when used with Next.js, so I'm not sure how it relates strictly to server-side rendering/hydration.
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.