Babel ignore several directories

前端 未结 4 1896
鱼传尺愫
鱼传尺愫 2021-01-01 13:17

I\'m currently running Babel with a simple command :

$ babel . --ignore node_modules --out-dir dist

But I can\'t find a way to ignore sever

相关标签:
4条回答
  • 2021-01-01 14:00

    You can ignore multiple directories and specify a globbing pattern within the .babelrc file like this

    {
        ...,
        "ignore": [
            "node_modules",
            "dir_2",
            "dir_3/**/*.js"
        ]
    }
    

    Reference: https://babeljs.io/docs/en/babelrc

    0 讨论(0)
  • 2021-01-01 14:05

    You should be able to use commas in the cli

    babel . --ignore node_modules,test --out-dir dist

    0 讨论(0)
  • 2021-01-01 14:10

    Note that there's a known bug in babel, where it ignores only and ignore in .babelrc.

    The relevant bug is T6726, which has been fixed in babel 6.14.0.

    0 讨论(0)
  • 2021-01-01 14:16

    With Babel 7 you need to use a glob pattern:

    babel . --ignore */node_modules,*/test --out-dir dist
    
    0 讨论(0)
提交回复
热议问题