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.

Render warning with nuxt

See original GitHub issue

Hello there, I have a problem when rendering svgs in my nuxt project. It always shows me the following warning in the browser console: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.

I am using the default config from the Readme file.

build: {
  /*
  ** You can extend webpack config here
  */
  extend(config, ctx) {
    // Run ESLint on save
    if (ctx.isDev && ctx.isClient) {
      config.module.rules.push({
        enforce: 'pre',
        test: /\.(js|vue)$/,
        loader: 'eslint-loader',
        exclude: /(node_modules)/,
      });

      const vueRule = config.module.rules.find(rule => {
        return rule.test.test('.vue');
      });
      vueRule.use = [
        {
          loader: vueRule.loader,
          options: vueRule.options,
        },
        {
          loader: 'vue-svg-inline-loader',
        },
      ];
      delete vueRule.loader;
      delete vueRule.options;
    }
  },
},

Is there anything wrong with the configuration or am I just missing anything or is it supposed to be like that? Thanks in advance!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
oliverfindlcommented, Feb 3, 2019

Hello,

I finally figured what is going on. You have modified vue rule in condition if (ctx.isDev && ctx.isClient) { /* ... */ }, but it has to be outside. This resulted in nuxt not using loader in ssr. If you move the code outside that condition it will work.

Please give feedback if it solved your issue.

Thanks

0reactions
oliverfindlcommented, Feb 3, 2019

Glad to hear!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server Side Rendering - Nuxt
Server-side rendering (SSR), is the ability of an application to contribute by displaying the web-page on the server instead of rendering it in...
Read more >
Error handling · Get Started with Nuxt
Rendering an Error Page. When Nuxt encounters a fatal error, whether during the server lifecycle, or when rendering your Vue application (both SSR...
Read more >
Nuxt App [Vue warn]:Component inside <Transition> renders ...
Nuxt App [Vue warn]:Component inside <Transition> renders non-element root node that cannot be animated. Save this question. Show activity on ...
Read more >
[Vue warn]: The client-side rendered virtual DOM tree is not ...
[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example ......
Read more >
API: The <client-only> Component - NuxtJS
Render a component only on client-side, and display a placeholder text on ... Warning: If you are using a version of Nuxt <...
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