From 67a3ee946b7f908b11d18866d5e7fddab63ac04c Mon Sep 17 00:00:00 2001 From: Nikolaus Piccolotto Date: Fri, 24 Feb 2017 15:01:33 +0100 Subject: [PATCH] fix babel module definition --- .babelrc | 15 +++++++++++++-- package.json | 6 +++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.babelrc b/.babelrc index f5066b9..52e8bbe 100644 --- a/.babelrc +++ b/.babelrc @@ -1,7 +1,18 @@ { - "presets": [ + "env": { + "production": { + "presets": [ ["es2015", { "modules": false }], "react", "stage-2" - ] + ] + }, + "test": { + "presets": [ + ["es2015", { "modules": "commonjs" }], + "react", + "stage-2" + ] + } + } } diff --git a/package.json b/package.json index 2bd5353..0368ae6 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,10 @@ "description": "Automatically sets width property on child components", "main": "dist/react-automatic-width.js", "scripts": { - "test": "mocha --compilers js:babel-register test/{**,.}/*.test.js", + "test": "BABEL_ENV=test mocha --compilers js:babel-register test/{**,.}/*.test.js", "lint": "eslint src/react-automatic-width.jsx", - "build": "webpack", - "test-coverage": "babel-node ./node_modules/.bin/babel-istanbul cover _mocha -- --compilers js:babel-register test/{**,.}/*.test.js && cat ./coverage/lcov.info | coveralls", + "build": "BABEL_ENV=production webpack", + "test-coverage": "BABEL_ENV=test babel-node ./node_modules/.bin/babel-istanbul cover _mocha -- --compilers js:babel-register test/{**,.}/*.test.js && cat ./coverage/lcov.info | coveralls", "prepublish": "npm test && npm run-script build" }, "repository": {