question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't work on the server side

See original GitHub issue

Thanks for the great work. I’m trying to get this loader to work on server side as well. Since it’s touches document directly, I guess getting it to work on the server is currently not possible. Can you please confirm? If that is the case, do you have any plans of making it to work on the server as well?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:26 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
hyatt03commented, Jun 16, 2016

Hi everyone! I’ve run into a similar issue, however I didn’t want to webpack my entire backend so I came up with a kinda hacky solution.

I was already using ignore-styles as I import relevant stylesheets into my react components, so in order to generate the correct server side markup I just needed to add the following to my bootstrapping file:

const path = require('path');
const crypto = require('crypto');

require('ignore-styles').default(['.scss', '.css', '.svg'], (module, filename) => {
  const base = path.basename(filename);
  if (base.indexOf('.svg') > 0) {
    module.exports = '#' + crypto.createHash('md5').update(filename).digest("hex");
  }
});

Note this works with the following webpack config:

{
  ...
  module: {
    loaders: [
      {
        test: /\.svg$/,
        loader: 'svg-sprite?' + JSON.stringify({
          name: '[pathhash]',
          prefixize: true
        })
      }
    ]
  },
  ...
}

I hope this helps somebody! 😃

3reactions
danilobuergercommented, Apr 25, 2016

Shouldn’t something like SSR live in the default sprite impl? The very least it should do on a node environment it just return the symbol id (without using document) instead of failing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are server side errors? - Branding Questions and Answers
Server-side errors are errors that occur on the server when a client (such as a web browser) tries to access a website or...
Read more >
Server side issues
It is a server when accepting HTTP requests from clients connecting to it, but it acts like a client to the remote servers...
Read more >
Server-side processing doesn't seem to work - DataTables
Hi, I'm using Datatables.net (for about 2.5 years now - great product) but I'm having an issue with server-side processing.
Read more >
Troubleshooting and monitoring server-side synchronization
This article introduces how to troubleshoot item level Server-Side Synchronization issues with Microsoft Dynamics 365.
Read more >
Introduction to the server side - Learn web development | MDN
Welcome to the MDN beginner's server-side programming course! ... code constructs designed to solve common problems, speed up development, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found