相关疑难解决方法(0)

vue webpack模板缺少解析器

我只是使用webpack模板设置一个vue项目,如下所示:http://vuejs-templates.github.io/webpack/

但是在运行npm run dev之后只是为了测试模板是否正常工作,我得到了这个错误:

Failed to compile with 2 errors                                                                                                                                                                                                                                                           21:49:02
 error  in ./src/App.vue

Module build failed: Error: No parser and no file path given, couldn't infer a parser.
    at normalize (path\node_modules\prettier\index.js:7051:13)
    at formatWithCursor (path\node_modules\prettier\index.js:10370:12)
    at path\node_modules\prettier\index.js:31115:15
    at Object.format (path\node_modules\prettier\index.js:31134:12)
    at Object.module.exports (path\node_modules\vue-loader\lib\template-compiler\index.js:80:23)

 @ ./src/App.vue 11:0-354
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

 error  in ./src/components/HelloWorld.vue

Module build failed: Error: No parser and no file path given, couldn't infer a parser.
    at normalize (path\node_modules\prettier\index.js:7051:13)
    at formatWithCursor (path\node_modules\prettier\index.js:10370:12)
    at …
Run Code Online (Sandbox Code Playgroud)

webpack vue.js prettier

40
推荐指数
3
解决办法
7313
查看次数

npm run serve 永远挂起 vue

我正在尝试将 HTML 模板移植到.vue文件中。我知道在这个问题中存在深度嵌套 DOM 的已知问题,但我vue.config.js已经看起来像这样:

module.exports = {
  chainWebpack: (config) => {
    const vueRule = config.module.rule('vue');
    vueRule.uses.clear();
    const vueLoader = vueRule.use('vue-loader').loader('vue-loader');
    vueLoader.options({
      prettify: false,
    });
  },
};
Run Code Online (Sandbox Code Playgroud)

npm run serve 永远挂在 22% 上,看起来像这样:

> vue-cli-service serve

 INFO  Starting development server...
 22% building 106/110 modules 4 active ...bout.vue?vue&type=template&id=039c5b43&
Run Code Online (Sandbox Code Playgroud)

虽然NODE_ENV=production npm run serve运行得很好。

这是我About.vue挂在渲染上的整个文件:


<!DOCTYPE html>
<html lang="en">
<head>
<title>About us</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Destino project">
<meta name="viewport" …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-cli

6
推荐指数
0
解决办法
2007
查看次数

Vue 在开发模式下编译这个 HTML 模板非常慢

我正在使用通过 vue CLI 引导的模板应用程序设置。我有一个包含 20 个嵌套div标签的组件。在开发模式下编译这样的组件大约需要 10 秒。我将 html 元素嵌套得越深,所需的时间就越长,并且时间呈指数增长。

这种行为正常吗?有没有办法改善编译时间?

这是一个例子:https : //gist.github.com/dmitrybelyakov/ed64145624f42188372500018671eb0f

javascript vue.js vue-component vuejs2

4
推荐指数
1
解决办法
4697
查看次数

标签 统计

vue.js ×3

javascript ×2

prettier ×1

vue-cli ×1

vue-component ×1

vuejs2 ×1

webpack ×1