Git Product home page Git Product logo

vite-plugin-vue-pug-indent-fix's Introduction

vite-plugin-vue-pug-indent-fix

This plugin is resolve the Unexpected token "indent" error in Vue 3.

How to use this plugin

Vite

vite.config.js

import vue from '@vitejs/plugin-vue'
import vitePluginVuePugIndentFix from "vite-plugin-vue-pug-indent-fix"

export default defineConfig({
  plugins: [vitePluginVuePugIndentFix(), vue()],
})

Nuxt

nuxt.config.js

import vitePluginVuePugIndentFix from "vite-plugin-vue-pug-indent-fix"

export default defineNuxtConfig({
  vite: {
    plugins: [vitePluginVuePugIndentFix()]
  }
})

vite-plugin-vue-pug-indent-fix's People

Contributors

baw-appie avatar

Stargazers

william santos avatar  avatar Andris Lukjanovics avatar Taras Bilohan avatar Sanghee Park avatar

Watchers

 avatar

vite-plugin-vue-pug-indent-fix's Issues

This isn't work in Vite.

This is my vite.config, but it isn't work.
It still have error 'unexpected token "indent"' at run build.
I use Vite v4.0.0.
What part have I done wrong?

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vuePugPlugin from 'vue-pug-plugin'
import eslintPlugin from 'vite-plugin-eslint'
import vitePluginVuePugIndentFix from 'vite-plugin-vue-pug-indent-fix'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vitePluginVuePugIndentFix(),
    vue({
      template: {
        // 'preprocessOptions' is passed through to the pug compiler
        preprocessOptions: {
          plugins: [vuePugPlugin],
        },
      },
    }),
    eslintPlugin(),
  ],
})

Bundling with plugin fails in case when template block is not first

Steps to reproduce:

  1. move template block after script or style
  2. build project

Possible reason is string

        if(src.startsWith("<template")) { // Vue3 setup component

I'm not sure that it's correct check. Possibly it's better to just search for template block with regext and check matches is present?

Typescript support

Hello together,

I am using your package at a Nuxt 3 (v.3.10.2), additionaly i am using typescript (v5.3.3).

If i put your package to the vite plugins at nuxt.config.ts, the ts compiler throws the following error:

image

I am not familar with writing d.ts modules my self.

Could you or anyone else support us a type declaration file plz?

Many thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.