vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.75k stars 6.32k forks source link

vue-cli3.3.0 不能配合vuepress 0.14.8以上版本工作 #3341

Closed ziyi2 closed 5 years ago

ziyi2 commented 5 years ago

Version

3.3.0

Reproduction link

http://localhost:8084/

Environment info

vue-cli: 3.3.0
vuepress 0.14.8
npm 6.1.0
node v10.3.0

Steps to reproduce

vue create 生成项目

npm install vuepress -D

npm run dev ("dev": "vuepress dev docs", docs中就一个README.md)

What is expected?

PS G:\git-lab\hui-vuepress> npm run dev

hui-vuepress@0.1.0 dev G:\git-lab\hui-vuepress vuepress dev docs

WAIT Extracting site metadata...

DONE [19:14:58] Build cd735c finished in 5546 ms!

VuePress dev server listening at http://localhost:8084/

What is actually happening?

ERROR in ./node_modules/vuepress/lib/app/app.js 11:6 Module parse failed: Unexpected token (11:6) You may need an appropriate loader to handle this file type. import themeEnhanceApp from '@temp/themeEnhanceApp'; // generated from user config

import('@temp/style.styl'); // built-in components | | import Content from './components/Content'; @ ./node_modules/vuepress/lib/app/clientEntry.js 4:0-34 8:17-26 @ multi ./node_modules/vuepress/lib/app/clientEntry.js


1、去除本地安装vuepress,采用全局安装,可以运行 2、采用yarn安装可以

vuepress官方文档说

如果你的现有项目依赖了 webpack 3.x,推荐使用 Yarn 而不是 npm 来安装 VuePress。因为在这种情形下,npm 会生成错误的依赖树。

ziyi2 commented 5 years ago

vue create的时候就加了babel和eslint

LinusBorg commented 5 years ago

Possible duplicate of #3335

haoqunjiang commented 5 years ago

Confirmed, duplicate of #3335. Can be fixed by npm i -D webpack@~4.28

ziyi2 commented 5 years ago

OK,那我觉得这个处理不是特别好,

Confirmed, duplicate of #3335. Can be fixed by npm i -D webpack@~4.28

OK,那我觉得这个处理不是特别好,因为如果组员vue create或npm install之后还需要重新去兼容webpack的版本,这里我们的vuepress只是作为开发态UI的视图调试,那为了和vue cli3互不干扰,采用全局安装的形式应该是不错的选择把。