How to use ES6 with PhantomJS

后端 未结 2 1429
心在旅途
心在旅途 2020-12-09 15:26

Is there a way to use ES6 and modules with PhantomJS?

I can transpile each file from ES6 to ES5 using Babel, but it\'s awkward to maintain parallel trees (one in ES6

相关标签:
2条回答
  • 2020-12-09 15:50

    Browserify's --exclude option does what I need.

    browserify --exclude webpage -t babelify script.js --outfile compiled.js
    phantomjs compiled.js
    

    That excludes webpage from the dependency tree but leaves the import in place.

    0 讨论(0)
  • 2020-12-09 15:51

    According to PhantomJS dev's comment on GitHub, the full support of ES6 will come with PhantomJS 2.5.

    0 讨论(0)
提交回复
热议问题