From 98a01977b1093bfd75be19d27d4f8dadd18a6e42 Mon Sep 17 00:00:00 2001 From: Antti Lehto Date: Mon, 25 Sep 2017 17:39:49 +0300 Subject: [PATCH] Add es2015 module build --- .babelrc | 22 +++++++++++++++++----- package.json | 5 ++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.babelrc b/.babelrc index 7b1c04e..54f9ec7 100644 --- a/.babelrc +++ b/.babelrc @@ -1,7 +1,19 @@ { - "presets": [ - "react", - [ "es2015", { "loose": true } ] - ], - "plugins": [ "transform-runtime", "transform-object-rest-spread" ] + + "env": { + "development": { + "presets": [ + "react", + [ "es2015", { "loose": true } ] + ], + "plugins": [ "transform-runtime", "transform-object-rest-spread" ] + }, + "es": { + "presets": [ + "react", + [ "es2015", { "loose": true, "modules": false } ] + ], + "plugins": [ "transform-runtime", "transform-object-rest-spread" ], + } + } } diff --git a/package.json b/package.json index aaee88f..de0d302 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,14 @@ "version": "0.9.7", "description": "React Component Wrapper for Google reCAPTCHA", "main": "lib/recaptcha-wrapper.js", + "module": "lib/es/recaptcha-wrapper.js", "directories": { "lib": "lib/" }, "scripts": { - "build": "rm -rf lib && babel src --out-dir lib", + "build": "rm -rf lib && npm run build:cjs && npm run build:es", + "build:cjs": "babel src --out-dir lib", + "build:es": "BABEL_ENV=es babel src --out-dir lib/es", "lint": "eslint ./", "lint:fix": "eslint ./ --fix", "test": "karma start --single-run",