[英]Babel ignore equivalent in ember engines?
In a traditional Ember app, I have something along the lines of this in my ember-cli-build.js
: 在传统的Ember应用程序中,我的ember-cli-build.js
:
//ember-cli-build.js
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
babel: {
includePolyfill: true,
ignore: ['my-ember-ui/models/myFile.js'] // <-- question is here
},
Is there an equivalent to this when using an Ember Engine (or addon)? 使用Ember Engine(或插件)时,有与此等效的功能吗? I couldn't find anything within ember-cli-babel or ember-engines. 我在ember-cli-babel或ember-engines中找不到任何东西。
I understand that ember-cli-build.js
is just for the dummy app when using an engine, so I wouldn't make the change there. 我了解ember-cli-build.js
仅用于使用引擎时的虚拟应用程序,因此我不会在此处进行更改。 I attempted similar to above in the index.js
file, but did not have any luck. 我在index.js
文件中尝试了与上面类似的操作,但是没有任何运气。 The file was not ignored by babel. 该文件未被babel忽略。 I need a way to ignore a particular file. 我需要一种忽略特定文件的方法。 Thanks! 谢谢!
Well, adding new rules to Cli.build.js is ok depends on what you want to do. 好了,可以向Cli.build.js添加新规则取决于您要执行的操作。 However, I may have another solution that you can give it a try. 但是,我可能还有其他解决方案,您可以尝试一下。
Babel will look for a .babelrc
in the current directory of the file being transpiled. 巴贝尔将寻找一个.babelrc
在文件的当前目录被transpiled。 If one does not exist, it will travel up the directory tree until it finds either a .babelrc
, or a package.json
with a "babel": {}
hash within.(.babelrc files are serializable JSON). 如果不存在,它将沿目录树向上移动,直到找到.babelrc
或带有"babel": {}
哈希值的package.json
。(。babelrc文件是可序列化的JSON)。
{
"plugins": ["transform-react-jsx"],
"ignore": [
"foo.js",
"bar/**/*.js"
]
}
or 要么
{
"name": "my-package",
"version": "1.0.0",
"babel": {
// my babel config here
}
}
There should be another way which seems ok to use. 应该有另一种似乎可以使用的方式。 the following does work: 以下工作:
babel src --out-dir build --ignore "**/*.test.js" // or simply add your file
For more information, you can read Babel document 有关更多信息,您可以阅读Babel文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.