react-three-renderer icon indicating copy to clipboard operation
react-three-renderer copied to clipboard

.babelrc instead of inline in package.json

Open ashl1 opened this issue 8 years ago • 2 comments

The case

  • some of libs in npm registry provides only ES6 builds
  • we want to support browsers with ES5 builds

Solution we use

  • enable babel for node_modules directory

Problem

While Babel is run for files provided by npm, the Babel configuration is presented in the package.json file. But the already babelified js file will be used. Threfore our (external) Babel tries to use (internal) Babel config. The configuration between your package and our Babel might be different.

Decision

Could you take the Babel settings out and put them on separate .babelrc file and add the file to .npmignore? If user wants to develop an app he will use Git sources with .babelrc. If he simply wants to use the builded form of your package, this won't be affected by the internal Babel settings.

ashl1 avatar Oct 17 '17 20:10 ashl1

That sounds reasonable, do you have an example set up so I can try to see if I did it right?

On Tue, Oct 17, 2017, 21:18 Alexey Shildyakov [email protected] wrote:

The case

  • some of libs in npm registry provides only ES6 builds
  • we want to support browsers with ES5 builds

Solution we use

  • enable babel for node_modules directory

Problem

While Babel is run for files provided by npm, the Babel configuration is presented in the package.json file. But the already babelified js file will be used. Threfore our (external) Babel tries to use (internal) Babel config. The configuration between your package and our Babel might be different. Decision

Could you take the Babel settings out and put them on separate .babelrc file and add the file to .npmignore? If user wants to develop an app he will use Git sources with .babelrc. If he simply wants to use the builded form of your package, this won't be affected by the internal Babel settings.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/toxicFork/react-three-renderer/issues/200, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0iLQ-gWZ7JWBwDn1lRMsS9bw7Gq3SGks5stQtAgaJpZM4P8wbf .

toxicFork avatar Oct 17 '17 20:10 toxicFork

FYI https://philipwalton.com/articles/deploying-es2015-code-in-production-today/ I can make a PR tommorow

ashl1 avatar Oct 17 '17 23:10 ashl1