How to use ES6 with PhantomJS

后端 未结 2 1433
心在旅途
心在旅途 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.

提交回复
热议问题