@arnosaine/extend-react-scripts
Advanced tools
Comparing version 0.2.1 to 0.3.0
{ | ||
"name": "@arnosaine/extend-react-scripts", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Helper package for @arnosaine/react-scripts.", | ||
@@ -5,0 +5,0 @@ "repository": { |
# @arnosaine/extend-react-scripts | ||
Helper package for [@arnosaine/react-scripts](react-scripts). | ||
Helper package for [@arnosaine/react-scripts](https://www.npmjs.com/package/@arnosaine/react-scripts). |
@@ -1,17 +0,27 @@ | ||
import equals from './equals'; | ||
import { strict as assert } from 'assert'; | ||
import requireResolveCwdSafe from './requireResolveCwdSafe'; | ||
const babelLoader = require.resolve('babel-loader'); | ||
export default config => { | ||
const hasConfig = ['.babelrc', 'babel.config'].some(requireResolveCwdSafe); | ||
export default (config) => { | ||
for (const { oneOf = [] } of config.module.rules) { | ||
for (const { loader, options } of oneOf) { | ||
if (loader === babelLoader) { | ||
equals(options.babelrc, false, 'babelrc'); | ||
delete options.babelrc; | ||
if (hasConfig) { | ||
const babelLoader = require.resolve('babel-loader'); | ||
for (const { oneOf } of config.module.rules) { | ||
if (oneOf) { | ||
for (const { loader, options } of oneOf) { | ||
if (loader === babelLoader) { | ||
assert.equal(options.babelrc, false, 'babelrc'); | ||
delete options.babelrc; | ||
equals(options.configFile, false, 'babel.config.js'); | ||
delete options.configFile; | ||
assert.equal(options.configFile, false, 'configFile'); | ||
delete options.configFile; | ||
equals(!options.cacheIdentifier, false, 'cacheIdentifier'); | ||
delete options.cacheIdentifier; | ||
assert.equal( | ||
typeof options.cacheIdentifier, | ||
'string', | ||
'cacheIdentifier' | ||
); | ||
delete options.cacheIdentifier; | ||
} | ||
} | ||
} | ||
@@ -18,0 +28,0 @@ } |
import babel from './babel'; | ||
import eslint from './eslint'; | ||
import requireResolveCwdSafe from './requireResolveCwdSafe'; | ||
export default module => { | ||
let configPath; | ||
for (const path of [ | ||
`${process.cwd()}/webpack.config`, | ||
'../../../../webpack.config', | ||
]) { | ||
try { | ||
configPath = require.resolve(path); | ||
break; | ||
} catch (error) { | ||
// No custom config found. | ||
} | ||
} | ||
const configPath = requireResolveCwdSafe('webpack.config'); | ||
const config = module.exports; | ||
const extended = env => babel(eslint(config(env))); | ||
const extended = env => babel(config(env)); | ||
module.exports = configPath | ||
@@ -20,0 +9,0 @@ ? env => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
2295
6
50