1

Recently I stumbled upon a library for nodejs, that I want to use in a frontend project. Because the whole project is developed in ES6, the library should not be transpiled (we only develop for browsers, supporting es6). Of course, I could "browserify" manually, but because it can be a reoccurring task, I would like to use browserify without babelify or any es6 transpilation process. If transpilation is needed later on, I'd integrate it into the whole build process, but not beforehand.

Is there any option to browserify to omit es6 to ecmascript-5.1 transpilation?

SeDav
  • 761
  • 7
  • 19
  • What problems did you meet and what did make you think that you can't? Browserify doesn't do transpilation itself. That's why there are plugins like Babelify. – Estus Flask Jan 04 '18 at 12:43
  • browserify works fine, but the output is ecmascript-5.1 rather than es6. I want to disable the babelify process. – SeDav Jan 04 '18 at 12:44
  • Then don't install Babelify and don't use it in configuration or anywhere else. Again, Browserify doesn't do transpilation by default. – Estus Flask Jan 04 '18 at 12:46
  • No, that's why I'm asking here. browserify cli quits, when babelify isn't installed. I want to know the command line option to disable transpilation plugin. – SeDav Jan 04 '18 at 12:52
  • Please, update the question with clear description of what you're doing and other details that could solve the issue, which packages you installed, including their versions. The problem that you imply and expect to affect everyone just doesn't exist. Browserify [does not have Babelify among its dependencies](https://www.npmjs.com/package/browserify) and cannot physically transpile anything when Babelify is not explicitly used. I run `browserify ./example.js` and can clearly see that it is still ES6, just browserified. – Estus Flask Jan 04 '18 at 13:06
  • It turned out that the library, I was wanting to browserify, had some options to browserify in it's `package.json`, which "magically" enabled the babelify plugin. Shall I post this as an answer or still modify the question? – SeDav Jan 04 '18 at 13:11
  • I'd suggest to post this as an answer since this may help somebody with such problem. – Estus Flask Jan 04 '18 at 13:19

1 Answers1

1

By default, browserify does not do any transpilation process, if no plugins are enabled. It turned out, that the library I wanted browserify, passed some options to browserify in its package.json:

"browserify": {
    "transform": [ [ "babelify", { "presets": "es2015" } ] ]
}

this caused browserify to use the babelify plugin by default.

SeDav
  • 761
  • 7
  • 19