-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected token "indent" on Vue 3 template #18
Comments
Same problem, cant use beautifier due of this. Should be fixed as vue3 coming fast to get as daily. |
When can this be fixed? |
Hey 👋 @yyx990803 Could you take a look at this issue please? Pug users cannot upgrade to Vue 3 with this bug :/ Thank you! |
The solution are pretty simple, if using VSCode switch to Volar plugin and it's formatter. Honestly I forgot about this problem since. Also I recommend migrating from Webpack to Vite |
I've wanted to update to Vue 3, but the issue of indentation makes it really hard. I understand that not indenting is more performant for the source maps, but I'd like to keep indenting if possible. Any solutions for this? |
Is there already a solution to keep the indentation? |
@infostatus Not that I am aware - I had to cave in and just go with the indentation |
This is a problem with the actual pug compiler since root components can't start with an indent. |
Vue 3.X is in "latest" channel now while this problem still unsolved. I did not understand what it is the actual cause of this problem. Pug? Vue3? @vue/compiler-sfc? Webpack? vue-loader? |
@TokugawaTakeshi it's a problem with vue3, compiler and Pug all together and not actually a problem at all. Vue 3 now adds indent token when you start your html template with an indent, pug on the other hand can't start with indent, it needs to start with a tag. Imo it's not even a problem, just a code style change. Since and vue3 compiler and pug are both not wrong in this case. |
Because Mr. Guillaume Briday already tried to call mr. Evan You in fourth comment, I suppose it's meaningless to try this again. Which other options we have? Hire some freelancer ask him to create the pull request fixing this issue? |
@TokugawaTakeshi you can use the @webdiscus/pug-loader. This Pug loader supports for an indent (spaces and tabs) in Vue template: <template lang='pug'>
h1 Hello Pug!
p Use the '@webdiscus/pug-loader'.
</template> This Pug loader works with Vue 3. Here is source of usage example. |
@webdiscus what code changes have you made from original pug-loader to yours? |
I have written completely new code, it is not a fork from original pug-loader. What can the @webdiscus/pug-loader:
|
Thank you for the suggestion. Looks like great, but I need some help with the configuration for my needs. |
For a question you can open new discussion. |
I solved it by downgrading node version from 16.15.1 to 14.2.0, but I'm not quite sure why this happens |
Is this problem resolved? |
According my newest information, in Vue 3 - no. If resolved, I am sorry at advance. |
Is this problem resolved ? |
Note that for some of you, coming from a search engine, as for me, this error might not be related to this repo! This is the stack trace I got with
The only packages involved here are:
In my case, I think
|
same issue. The code cannot be formatted, otherwise this error will appear. |
try to use the @webdiscus/pug-loader. This pug loader works with formatted pug templates. |
@webdiscus Is there a corresponding vite plugin? |
this loader is not for Vite, only for Webpack |
Vue version:
3.0.1
Related issue: vuejs/rollup-plugin-vue#86
With the default indentation style of 2 spaces on templates, I'm getting the following issue:
This doesn't seem to happen on version 2 though.
--
Possible solution #17
The text was updated successfully, but these errors were encountered: