简体   繁体   中英

How to prevent WebStorm 2016.2 Babel plugin from compiling in certain directories?

I've enabled the Babel File Watcher, as described here .

It does its job, but also seems to get active in places I don't want - my app/lib , server and node_modules folders.

The Webstorm blog (link above) suggests making a separate "Scope" that would exclude unwanted directories. I'm looking for other solutions, since:

  • I would prefer the solution to be in version controlled files, not the WebStorm preferences

I tried setting up .babelrc as such:

{
  "presets": ["es2015"],
  "ignore": [
    "node_modules/**",
    "app/lib/**",
    "server/**"
  ]
}

This did not change the behaviour.

I presume the Babel "presets" system cannot be overridden?

The only solution is using scopes as suggested in blog - when using default scope (Project Files) Babel watcher listens to all .js files in your project. So, Babel will be started for all them - and .babelrc is checked once the process is started, not before starting it. Scopes are stored with project, in .idea folder. If you like to version control scopes, use 'shared' type - see https://www.jetbrains.com/help/webstorm/2016.2/scope.html#d317067e51

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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