很抱歉版本号打错了,误导了一些人。因为今天segmentfault ios手机端用sogou输入法编辑问题切换到英文会一直乱打字。。我也不知道什么问题。。实在抱歉
原因是prettier 更新到1.13.0导致的
component-compiler-utils 1.3.1 已经更新修复了.
具体, https://github.com/vuejs/comp...
error
in ./src/App.vue
Module build failed: Error: No parser and no file path given, couldn't infer a parser.
at normalize (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:7051:13)
at formatWithCursor (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:10370:12)
at F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:31115:15
at Object.format (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:31134:12)
at Object.module.exports (F:\WebStormProjects\a9043-blog-mobile\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 (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:7051:13)
at formatWithCursor (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:10370:12)
at F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:31115:15
at Object.format (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:31134:12)
at Object.module.exports (F:\WebStormProjects\a9043-blog-mobile\node_modules\vue-loader\lib\template-compiler\index.js:80:23)
@ ./src/components/HelloWorld.vue 11:0-366
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
see: https://github.com/vuejs/comp...
抱歉, 因为在github里面track, 没有更新这里。
问题背景:
这里出现的问题是因为prettier, 一个vue-cli的依赖,把一个feature 的移除当作次版本发布。 这个导致npm install 到的@vue/component-compiler-utils 的runtime 出错导致。
和prettier 作者沟通后, 为了避免碎片化, prettier 没有计划发布新的版本来更正这个, 所以我发送了一个PR 到component-compiler-utils并且在PR 合并前提供了一个workaround 去降级prettier 到更新之前的版本。
美国晚上晚些时候Evan(vue 的作者)合并了PR 并发布了新的component-compiler-utils#1.3.1, 对于vue-loader v15,这个问题得以解决。 不过需要手动升级下component-compiler-utils。
解决方案:
如果是vue-loader v15
如果是vue-loader v14, 因为vue-loader 直接依赖prettier