[Vuejs]-External Pug Templates – Template syntax error Component template requires a root element, rather than just text

0👍

Sorted it with the help of Vue’s inspector:

vue inspect module.rules > rules-output.js

I had to add this to the chainWebpack section of my vue.config.js:

chainWebpack: webpackConfig => {
  webpackConfig.module
    .rule('pug')
      .oneOf('pug-template')
        .uses
          .delete('raw')
          .delete('pug-plain-loader')
          .end()
        .use('vue-template-loader')
          .loader('vue-template-loader')
          .end()
        .use('pug-plain-loader')
          .loader('pug-plain-loader')
          .end()
  },

Leave a comment