简体   繁体   English

如果从软件包的依赖项安装了cli-plugin-babel,则不会加载babel.config.js

[英]babel.config.js not loaded if cli-plugin-babel is installed from a package's dependencies

In my team, all dependencies are placed in a separate package's dependencies (eg. packageA). 在我的团队中,所有依赖项都放在单独的包的依赖项中(例如packageA)。 When I install this packageA in a project, all dependencies like vue and vue-cli will be installed too. 当我在项目中安装该packageA时,还将安装所有依赖项,例如vue和vue-cli。 Here is the problem. 这是问题所在。 The babel.config.js is not loaded. 未加载babel.config.js。 I put a console.log at the first line in this file, but it doesn't print anything when i start the project or run vue inspect. 我将console.log放在此文件的第一行,但是当我启动项目或运行vue inspect时,它不会显示任何内容。

However, when I place "@vue/cli-plugin-babel": "^3.9.0" in project's package.json's dependencies field instead of in packageA's. 但是,当我将"@vue/cli-plugin-babel": "^3.9.0"放在项目的package.json的依赖项字段而不是packageA的依赖项中时。 Console.log works which means babel.config.js is loaded. Console.log有效,这意味着已加载babel.config.js。

What happed here? 这里是什么? If I want the babel.config.js to be loaded in the first case, what can I do? 如果我想在第一种情况下加载babel.config.js,该怎么办?

Look at this...... 看这个...... vue-cli-doc

Vue Cli invoke plugins by searching dependencies in your project's package.json by default. 默认情况下,Vue Cli通过在项目的package.json中搜索依赖项来调用插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM