Skip to content

How to configure the plugin for both Vue and non-Vue usage? #16

Answered by webdiscus
TokugawaTakeshi asked this question in Q&A
Discussion options

You must be logged in to vote

Setup for Vue

Change your vue.config.js according to the following minimal configuration:

const { defineConfig } = require('@vue/cli-service');

module.exports = defineConfig({
  transpileDependencies: true,

  chainWebpack: (config) => {
    const pugRule = config.module.rule('pug');

    // IMPORTANT: clear all existing pug loader settings
    // defaults pug loader in Vue is `pug-plain-loader`
    pugRule.uses.clear();
    pugRule.oneOfs.clear();
  },

  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.pug$/,
          oneOf: [
            // allow <template lang="pug"> in Vue components
            {
              resourceQuery: /^\?vue/u,
              lo…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@TokugawaTakeshi
Comment options

@TokugawaTakeshi
Comment options

@webdiscus
Comment options

@TokugawaTakeshi
Comment options

@webdiscus
Comment options

Answer selected by TokugawaTakeshi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants