You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何判断Vue项目基于vue-cli 2还是3创建?导入Vue路径异常排查

How to Tell if Your Vue Project Was Created with vue-cli 2 or vue-cli 3+

Hey there! Let's break down how to figure out which version of vue-cli was used to create your project—super straightforward checks, no guesswork needed:

  • Check your project root directory structure

    • If you see build/ and config/ folders (with webpack config files like webpack.base.conf.js inside build/), plus a static/ folder for static assets, that's a dead giveaway for vue-cli 2.
    • If your project has a public/ folder instead of static/, and no build/ or config/ folders (configuration lives in a single vue.config.js file if you've customized it), then it's vue-cli 3 or later (vue-cli 3+ switched to a more streamlined structure).
  • Look at your package.json file

    • For vue-cli 2: You'll see vue-cli listed in your dependencies, and the scripts section will have something like "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js" for starting the dev server.
    • For vue-cli 3+: Your dependencies will include @vue/cli-service, and the dev start script will be "serve": "vue-cli-service serve". You might also see various @vue/cli-plugin-* packages if you added features like Babel or ESLint during setup.
  • Your Vue import quirk as a supporting clue
    The fact that you need to use import Vue from 'vue/dist/vue.js' instead of the standard import Vue from 'vue' also leans towards vue-cli 2. By default, vue-cli 2 uses the runtime-only build of Vue (which doesn't include the template compiler), so you have to import the full build to use inline templates. Vue-cli 3+ defaults to including the compiler build, so you wouldn't need this workaround unless you explicitly changed the config.

Put it all together, and you should have a clear answer!

内容的提问来源于stack exchange,提问作者Philipp S.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 04:02:01