[英]Can I have 2 babelrc files in one project?
I'm trying to add react to a very large solution, but one component on the site uses preact. 我正在尝试添加对一个非常大的解决方案的反应,但网站上的一个组件使用preact。 My current .bablerc is
我目前的.bablerc是
{
"presets": ["env"],
"ignore": [
"**/what-input.js",
"**/HostedPCIAdapter.js",
"InstantPreview/**/*.js",
"Wishlist/**/*.js"
],
"plugins": [
"transform-object-rest-spread",
"transform-react-jsx"
]
}
Original .baberc looked like this: 原来.baberc看起来像这样:
{
"sourceMaps": true,
"presets": [],
"plugins": [
[
"transform-react-jsx",
{
"pragma": "preact.h"
}
],
"transform-object-assign",
[
"transform-es2015-classes",
{
"loose": true
}
],
"transform-es2015-arrow-functions",
"transform-es2015-block-scoping",
"transform-es2015-template-literals"
]
}
So can I add pragma back for just the wishlist feature? 那么我可以为愿望清单功能添加pragma吗? Any help would be appreciated.
任何帮助,将不胜感激。 I'm using gulp as a taskrunner and webpack to build my assets.
我正在使用gulp作为taskrunner和webpack来构建我的资产。
Babel files can be nested in sub-directories with unique settings which is pretty cool stuff. Babel文件可以嵌套在具有独特设置的子目录中,这非常酷。
So if you have a folder structure like this: 所以如果你有这样的文件夹结构:
app
reactCode
.babelrc
index.js
preactCode
.babelrc
index.js
You can add a separate .babelrc file for branch. 您可以为分支添加单独的.babelrc文件。 I don't think it's ideal but if you're working with a large monolithic solution that has lots of different frameworks and requirements it certainly can fix a lot of bugs and QA work.
我认为这不是理想的,但如果您正在使用具有许多不同框架和要求的大型单片解决方案,它肯定可以解决许多错误和QA工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.