Electron-vue: Add pug as preprocessor

Created on 25 Sep 2018  ·  2Comments  ·  Source: SimulatedGREG/electron-vue

Describe the issue / bug.

I am trying pug as template processor, I did it before in vuejs 2 projects. It is compatible?

How can I reproduce this problem?

I installed with yarn:
yarn add pug pug-loader

Edited App.vue:

<template lang="pug">
  #app
    router-view
</template>

<script>
  export default {
    name: 'veedar'
  }
</script>

<style>
  /* CSS */
</style>

and run:
yarn run dev
But I got this error:

    Error compiling template:

    #app
        router-view

    - Component template requires a root element, rather than just text.
Tell me about your development environment.
  • Node version: 8.9.4
  • YARN version: 1.3.2

Most helpful comment

Seems that it works!
I added pug-plain loader
I edited webpack.renderer.config.js and add the rule:

{
  module: {
    rules: [
      {
        test: /\.pug$/,
        loader: 'pug-plain-loader'
      }
    ]
  }
} 

Thanks a lot!

All 2 comments

i think you must add pug-plain-loader instead

Seems that it works!
I added pug-plain loader
I edited webpack.renderer.config.js and add the rule:

{
  module: {
    rules: [
      {
        test: /\.pug$/,
        loader: 'pug-plain-loader'
      }
    ]
  }
} 

Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jt-wang picture jt-wang  ·  3Comments

alexiej picture alexiej  ·  3Comments

simdax picture simdax  ·  3Comments

haomehaode picture haomehaode  ·  3Comments

kinoli picture kinoli  ·  3Comments