1

npm run dev executes very fast.

When I add 1000 rows of html (header) to a .vue file (template), it takes 9 minutes to compile.

Question:

Does vue.js not support such a lengthy template?

Is there any way to speed up?

<template> <header class="..." > ... (1000 rows) </header> </template> <script> export default { name: 'Header' } </script> 
3
  • The question being? Commented Nov 14, 2017 at 7:01
  • @Vivick Thanks, I edited the question. Commented Nov 14, 2017 at 7:05
  • 2
    use a v-for loop Commented Nov 14, 2017 at 7:52

2 Answers 2

1

Because you are using a static template with static 1000 html elements. Use v-for!
What it will do is just compile (not run!) the Vue syntax on <template>.
Check this out as well: One Useful Link on Rows Rendering on Different Frameworks

Sign up to request clarification or add additional context in comments.

Comments

1

This is caused by prettier eslint.

Solution

Follow this steps to fix it.

  1. goto /node_modules/vue-loader/lib/template-compiler/index.js lines 78:81

  2. Change

 if (!isProduction) { code = prettier.format(code, { semi: false }) } 

to

 // if (!isProduction) { // code = prettier.format(code, { semi: false }) // } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.