Alexander Mills
Alexander Mills

Reputation: 100080

babelrc not sufficient to use with babel --watch

I have this .babelrc file:

{
  "presets": ["env"],
  "outDir":"target",
  "include":[
    "src/**/*.js"
  ],
  "ignore": []
}

I run babel -w and I get this error message:

--watch requires --out-file or --out-dir. --watch requires filenames

do I need to specify more options at the command line or is there something I can add to my .babelrc file?

Upvotes: 0

Views: 387

Answers (1)

Jorge
Jorge

Reputation: 50

There is no way to configure this in your .babelrc. But you could add something like this to the scripts section of your package.json:

"scripts": {
  "watch": "babel --watch src --out-dir dist"
}

Then you can just run npm run watch from the root of that project.

If you want to execute your project each time you compile, you can use babel-watch.

Upvotes: 2

Related Questions