babel-preset-insilico-react-app
Advanced tools
Comparing version
21
index.js
'use strict'; | ||
var path = require('path'); | ||
const path = require('path'); | ||
const objectAssign = require('object-assign'); | ||
@@ -77,4 +78,4 @@ /** | ||
module.exports = function(context) { | ||
var config; | ||
module.exports = function(context, envOptions) { | ||
let config; | ||
@@ -113,3 +114,3 @@ if (env === 'test') { | ||
require.resolve('babel-preset-env'), | ||
{ | ||
objectAssign({ | ||
targets: { | ||
@@ -125,4 +126,4 @@ // React parses on ie 9, so we should too | ||
// Do not transform modules to CJS | ||
modules: false, | ||
}, | ||
modules: getModulesMethod(), | ||
}, envOptions), | ||
], | ||
@@ -143,2 +144,8 @@ // JSX, Flow | ||
return config; | ||
}; | ||
}; | ||
function getModulesMethod() { | ||
if (!process.env.MODULES) return false | ||
if (process.env.MODULES === 'false' || process.env.MODULES === 'null') return false | ||
return process.env.MODULES | ||
} |
{ | ||
"name": "babel-preset-insilico-react-app", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Babel preset used by Insilico", | ||
@@ -19,6 +19,3 @@ "repository": "https://github.com/InSilicoCPH/babel-preset-insilico-react-app", | ||
"jest": { | ||
"testEnvironment": "node", | ||
"transformIgnorePatterns": [ | ||
"<rootDir>/(node_modules)/" | ||
] | ||
"testEnvironment": "node" | ||
}, | ||
@@ -50,3 +47,4 @@ "scripts": { | ||
"babel-preset-react": "^6.24.1", | ||
"babel-runtime": "^6.23.0" | ||
"babel-runtime": "^6.23.0", | ||
"object-assign": "4.1.1" | ||
}, | ||
@@ -53,0 +51,0 @@ "devDependencies": { |
@@ -11,6 +11,25 @@ # babel-preset-insilico-react-app | ||
```js | ||
{ | ||
"presets": ["insilico-react-app"] | ||
} | ||
``` | ||
```js | ||
{ | ||
"presets": ["insilico-react-app"] | ||
} | ||
``` | ||
You can send options along, that will be passed directly to `babel-preset-env`: https://github.com/babel/babel-preset-env. | ||
```js | ||
{ | ||
"presets": [ | ||
[ | ||
"insilico-react-app", | ||
{ | ||
"modules": "commonjs" | ||
} | ||
] | ||
] | ||
} | ||
``` | ||
By default modules (import/export) will not be transformed. If you need to that, you can either pass the relevant option or set the `MODULES` environment variable. | ||
Valid vaules: `"amd"` | `"umd"` | `"systemjs"` | `"commonjs"` | `false`. |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
7877
10.46%136
4.62%34
112.5%20
5.26%7
133.33%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed