rollup-plugin-babel
Advanced tools
Comparing version 5.0.0-alpha.1 to 5.0.0-alpha.2
@@ -61,7 +61,12 @@ 'use strict'; | ||
function fallbackClassTransform() { | ||
var PREFLIGHT_TEST_STRING = '__ROLLUP__PREFLIGHT_CHECK_DO_NOT_TOUCH__'; | ||
var PREFLIGHT_INPUT = "export default \"" + PREFLIGHT_TEST_STRING + "\";"; | ||
function helpersTestTransform() { | ||
return { | ||
visitor: { | ||
ClassDeclaration: function ClassDeclaration(path, state) { | ||
path.replaceWith(state.file.addHelper('inherits')); | ||
StringLiteral: function StringLiteral(path, state) { | ||
if (path.node.value === PREFLIGHT_TEST_STRING) { | ||
path.replaceWith(state.file.addHelper('inherits')); | ||
} | ||
}, | ||
@@ -72,4 +77,2 @@ }, | ||
var PREFLIGHT_INPUT = 'class Foo extends Bar {}\nexport default Foo;'; | ||
var mismatchError = function (actual, expected, filename) { return ("You have declared using \"" + expected + "\" babelHelpers, but transforming " + filename + " resulted in \"" + actual + "\". Please check your configuration."); }; | ||
@@ -79,14 +82,8 @@ | ||
function preflightCheck(ctx, babelHelpers, transformOptions) { | ||
var check = babel.transformSync(PREFLIGHT_INPUT, transformOptions).code; | ||
async function preflightCheck(ctx, babelHelpers, transformOptions) { | ||
var finalOptions = addBabelPlugin(transformOptions, helpersTestTransform); | ||
var check = (await babel.transformAsync(PREFLIGHT_INPUT, finalOptions)).code; | ||
if (~check.indexOf('class ')) { | ||
check = babel.transformSync(PREFLIGHT_INPUT, addBabelPlugin(transformOptions, fallbackClassTransform)).code; | ||
} | ||
if ( | ||
!~check.indexOf('export default') && | ||
!~check.indexOf('export default Foo') && | ||
!~check.indexOf('export { Foo as default }') | ||
) { | ||
// Babel sometimes splits ExportDefaultDeclaration into 2 statements, so we also check for ExportNamedDeclaration | ||
if (!/export (d|{)/.test(check)) { | ||
ctx.error(MODULE_ERROR); | ||
@@ -102,3 +99,3 @@ } | ||
if (~check.indexOf('babelHelpers.inherits')) { | ||
if (check.includes('babelHelpers.inherits')) { | ||
if (babelHelpers === EXTERNAL) { | ||
@@ -110,3 +107,4 @@ return; | ||
if (~check.indexOf('function _inherits')) { | ||
// test unminifiable string content | ||
if (check.includes('Super expression must either be null or a function')) { | ||
if (babelHelpers === INLINE || babelHelpers === BUNDLED) { | ||
@@ -116,5 +114,3 @@ return; | ||
if (babelHelpers === RUNTIME && !transformOptions.plugins.length) { | ||
ctx.error( | ||
("You must use the `@babel/plugin-transform-runtime` plugin when `babelHelpers` is \"" + RUNTIME + "\", but you have configured no babel plugins.\n") | ||
); | ||
ctx.error(("You must use the `@babel/plugin-transform-runtime` plugin when `babelHelpers` is \"" + RUNTIME + "\".\n")); | ||
} | ||
@@ -286,13 +282,20 @@ ctx.error(mismatchError(INLINE, babelHelpers, transformOptions.filename)); | ||
return transformCode(code, Object.assign({}, babelOptions, {filename: filename}), overrides, customOptions, this, function (transformOptions) { | ||
if (!skipPreflightCheck) { | ||
preflightCheck(this$1, babelHelpers, transformOptions); | ||
} | ||
return transformCode( | ||
code, | ||
Object.assign({}, babelOptions, {filename: filename}), | ||
overrides, | ||
customOptions, | ||
this, | ||
async function (transformOptions) { | ||
if (!skipPreflightCheck) { | ||
await preflightCheck(this$1, babelHelpers, transformOptions); | ||
} | ||
if (babelHelpers === BUNDLED) { | ||
transformOptions = addBabelPlugin(transformOptions, importHelperPlugin); | ||
if (babelHelpers === BUNDLED) { | ||
transformOptions = addBabelPlugin(transformOptions, importHelperPlugin); | ||
} | ||
return transformOptions; | ||
} | ||
return transformOptions; | ||
}); | ||
); | ||
}, | ||
@@ -299,0 +302,0 @@ }; |
import * as babel from '@babel/core'; | ||
import { transformSync, loadPartialConfig, transformAsync, buildExternalHelpers, DEFAULT_EXTENSIONS } from '@babel/core'; | ||
import { transformAsync, loadPartialConfig, buildExternalHelpers, DEFAULT_EXTENSIONS } from '@babel/core'; | ||
import { createFilter } from 'rollup-pluginutils'; | ||
@@ -60,7 +60,12 @@ import { addNamed } from '@babel/helper-module-imports'; | ||
function fallbackClassTransform() { | ||
var PREFLIGHT_TEST_STRING = '__ROLLUP__PREFLIGHT_CHECK_DO_NOT_TOUCH__'; | ||
var PREFLIGHT_INPUT = "export default \"" + PREFLIGHT_TEST_STRING + "\";"; | ||
function helpersTestTransform() { | ||
return { | ||
visitor: { | ||
ClassDeclaration: function ClassDeclaration(path, state) { | ||
path.replaceWith(state.file.addHelper('inherits')); | ||
StringLiteral: function StringLiteral(path, state) { | ||
if (path.node.value === PREFLIGHT_TEST_STRING) { | ||
path.replaceWith(state.file.addHelper('inherits')); | ||
} | ||
}, | ||
@@ -71,4 +76,2 @@ }, | ||
var PREFLIGHT_INPUT = 'class Foo extends Bar {}\nexport default Foo;'; | ||
var mismatchError = function (actual, expected, filename) { return ("You have declared using \"" + expected + "\" babelHelpers, but transforming " + filename + " resulted in \"" + actual + "\". Please check your configuration."); }; | ||
@@ -78,14 +81,8 @@ | ||
function preflightCheck(ctx, babelHelpers, transformOptions) { | ||
var check = transformSync(PREFLIGHT_INPUT, transformOptions).code; | ||
async function preflightCheck(ctx, babelHelpers, transformOptions) { | ||
var finalOptions = addBabelPlugin(transformOptions, helpersTestTransform); | ||
var check = (await transformAsync(PREFLIGHT_INPUT, finalOptions)).code; | ||
if (~check.indexOf('class ')) { | ||
check = transformSync(PREFLIGHT_INPUT, addBabelPlugin(transformOptions, fallbackClassTransform)).code; | ||
} | ||
if ( | ||
!~check.indexOf('export default') && | ||
!~check.indexOf('export default Foo') && | ||
!~check.indexOf('export { Foo as default }') | ||
) { | ||
// Babel sometimes splits ExportDefaultDeclaration into 2 statements, so we also check for ExportNamedDeclaration | ||
if (!/export (d|{)/.test(check)) { | ||
ctx.error(MODULE_ERROR); | ||
@@ -101,3 +98,3 @@ } | ||
if (~check.indexOf('babelHelpers.inherits')) { | ||
if (check.includes('babelHelpers.inherits')) { | ||
if (babelHelpers === EXTERNAL) { | ||
@@ -109,3 +106,4 @@ return; | ||
if (~check.indexOf('function _inherits')) { | ||
// test unminifiable string content | ||
if (check.includes('Super expression must either be null or a function')) { | ||
if (babelHelpers === INLINE || babelHelpers === BUNDLED) { | ||
@@ -115,5 +113,3 @@ return; | ||
if (babelHelpers === RUNTIME && !transformOptions.plugins.length) { | ||
ctx.error( | ||
("You must use the `@babel/plugin-transform-runtime` plugin when `babelHelpers` is \"" + RUNTIME + "\", but you have configured no babel plugins.\n") | ||
); | ||
ctx.error(("You must use the `@babel/plugin-transform-runtime` plugin when `babelHelpers` is \"" + RUNTIME + "\".\n")); | ||
} | ||
@@ -285,13 +281,20 @@ ctx.error(mismatchError(INLINE, babelHelpers, transformOptions.filename)); | ||
return transformCode(code, Object.assign({}, babelOptions, {filename: filename}), overrides, customOptions, this, function (transformOptions) { | ||
if (!skipPreflightCheck) { | ||
preflightCheck(this$1, babelHelpers, transformOptions); | ||
} | ||
return transformCode( | ||
code, | ||
Object.assign({}, babelOptions, {filename: filename}), | ||
overrides, | ||
customOptions, | ||
this, | ||
async function (transformOptions) { | ||
if (!skipPreflightCheck) { | ||
await preflightCheck(this$1, babelHelpers, transformOptions); | ||
} | ||
if (babelHelpers === BUNDLED) { | ||
transformOptions = addBabelPlugin(transformOptions, importHelperPlugin); | ||
if (babelHelpers === BUNDLED) { | ||
transformOptions = addBabelPlugin(transformOptions, importHelperPlugin); | ||
} | ||
return transformOptions; | ||
} | ||
return transformOptions; | ||
}); | ||
); | ||
}, | ||
@@ -298,0 +301,0 @@ }; |
130
package.json
{ | ||
"name": "rollup-plugin-babel", | ||
"version": "5.0.0-alpha.1", | ||
"description": "Seamless integration between Rollup and Babel.", | ||
"main": "dist/rollup-plugin-babel.cjs.js", | ||
"module": "dist/rollup-plugin-babel.esm.js", | ||
"files": [ | ||
"src", | ||
"dist" | ||
], | ||
"keywords": [ | ||
"rollup-plugin", | ||
"babel", | ||
"es2015", | ||
"es6" | ||
], | ||
"homepage": "https://github.com/rollup/rollup-plugin-babel", | ||
"author": "Rich Harris", | ||
"contributors": [ | ||
"Bogdan Chadkin <trysound@yandex.ru>", | ||
"Mateusz Burzyński <mateuszburzynski@gmail.com> (https://github.com/Andarist)" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"lint": "eslint src", | ||
"pretest": "npm run build", | ||
"test": "mocha", | ||
"prebuild": "rimraf dist", | ||
"build": "rollup -c", | ||
"prepare": "npm run build", | ||
"preversion": "npm run lint && npm test" | ||
}, | ||
"dependencies": { | ||
"@babel/helper-module-imports": "^7.7.4", | ||
"rollup-pluginutils": "^2.8.2" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "7 || ^7.0.0-rc.2", | ||
"rollup": ">=0.60.0 <2" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.7.4", | ||
"@babel/plugin-external-helpers": "^7.7.4", | ||
"@babel/plugin-proposal-decorators": "^7.7.4", | ||
"@babel/plugin-syntax-dynamic-import": "^7.7.4", | ||
"@babel/plugin-transform-runtime": "^7.7.4", | ||
"@babel/preset-env": "^7.7.4", | ||
"buble": "^0.19.8", | ||
"eslint": "^6.7.1", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"husky": "^3.1.0", | ||
"lint-staged": "^9.4.3", | ||
"mocha": "^6.2.2", | ||
"prettier": "^1.19.1", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.27.5", | ||
"rollup-plugin-buble": "^0.19.8", | ||
"rollup-plugin-json": "^4.0.0", | ||
"source-map": "^0.6.1", | ||
"source-map-support": "^0.5.16" | ||
}, | ||
"repository": "rollup/rollup-plugin-babel", | ||
"bugs": { | ||
"url": "https://github.com/rollup/rollup-plugin-babel/issues" | ||
} | ||
"name": "rollup-plugin-babel", | ||
"version": "5.0.0-alpha.2", | ||
"description": "Seamless integration between Rollup and Babel.", | ||
"main": "dist/rollup-plugin-babel.cjs.js", | ||
"module": "dist/rollup-plugin-babel.esm.js", | ||
"files": [ | ||
"src", | ||
"dist" | ||
], | ||
"keywords": [ | ||
"rollup-plugin", | ||
"babel", | ||
"es2015", | ||
"es6" | ||
], | ||
"homepage": "https://github.com/rollup/rollup-plugin-babel", | ||
"author": "Rich Harris", | ||
"contributors": [ | ||
"Bogdan Chadkin <trysound@yandex.ru>", | ||
"Mateusz Burzyński <mateuszburzynski@gmail.com> (https://github.com/Andarist)" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"lint": "eslint src", | ||
"pretest": "npm run build", | ||
"test": "mocha", | ||
"prebuild": "rimraf dist", | ||
"build": "rollup -c", | ||
"prepare": "npm run build", | ||
"preversion": "npm run lint && npm test" | ||
}, | ||
"dependencies": { | ||
"@babel/helper-module-imports": "^7.7.4", | ||
"rollup-pluginutils": "^2.8.2" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "7 || ^7.0.0-rc.2", | ||
"rollup": ">=0.60.0 <3" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.7.4", | ||
"@babel/plugin-external-helpers": "^7.7.4", | ||
"@babel/plugin-proposal-decorators": "^7.7.4", | ||
"@babel/plugin-syntax-dynamic-import": "^7.7.4", | ||
"@babel/plugin-transform-runtime": "^7.7.4", | ||
"@babel/preset-env": "^7.7.4", | ||
"buble": "^0.19.8", | ||
"eslint": "^6.7.1", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"husky": "^3.1.0", | ||
"lint-staged": "^9.4.3", | ||
"mocha": "^6.2.2", | ||
"prettier": "^1.19.1", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.27.5", | ||
"rollup-plugin-buble": "^0.19.8", | ||
"rollup-plugin-json": "^4.0.0", | ||
"source-map": "^0.6.1", | ||
"source-map-support": "^0.5.16" | ||
}, | ||
"repository": "rollup/rollup-plugin-babel", | ||
"bugs": { | ||
"url": "https://github.com/rollup/rollup-plugin-babel/issues" | ||
} | ||
} |
180
README.md
@@ -34,3 +34,29 @@ # rollup-plugin-babel | ||
### Command Line (`rollup`) | ||
#### Configuration | ||
`rollup.config.js` ([docs](https://rollupjs.org/guide/en/#configuration-files)): | ||
```js | ||
import babel from 'rollup-plugin-babel'; | ||
import pkg from './package.json'; | ||
const config = { | ||
input: 'src/index.js', | ||
output: [ | ||
{ | ||
file: pkg.module, | ||
format: 'esm', | ||
}, | ||
], | ||
plugins: [babel()], | ||
}; | ||
export default config; | ||
``` | ||
### Programmatic | ||
```js | ||
import { rollup } from 'rollup'; | ||
@@ -58,4 +84,2 @@ import babel from 'rollup-plugin-babel'; | ||
You can also run Babel on the generated chunks instead of the input files. Even though this is slower, it is the only way to transpile Rollup's auto-generated wrapper code to lower compatibility targets than ES5 (or most likely ES6 when Rollup 2 will be released), see [Running Babel on the generated code](#running-babel-on-the-generated-code) for details. | ||
### External dependencies | ||
@@ -119,154 +143,2 @@ | ||
## Running Babel on the generated code | ||
You can run rollup-plugin-babel on the output files instead of the input files by using `babel.generated(...)`. This can be used to perform code transformations on the resulting chunks and is the only way to transform Rollup's auto-generated code. By default, the plugin will be applied to all outputs: | ||
```js | ||
// rollup.config.js | ||
import babel from 'rollup-plugin-babel'; | ||
export default { | ||
input: 'main.js', | ||
plugins: [ | ||
babel.generated({ | ||
presets: ['@babel/env'], | ||
}), | ||
], | ||
output: [ | ||
{ file: 'bundle.cjs.js', format: 'cjs' }, | ||
{ file: 'bundle.esm.js', format: 'esm' }, | ||
], | ||
}; | ||
``` | ||
If you only want to apply it to specific outputs, you can use it as an output plugin (requires at least Rollup v1.27.0): | ||
```js | ||
// rollup.config.js | ||
import babel from 'rollup-plugin-babel'; | ||
export default { | ||
input: 'main.js', | ||
output: [ | ||
{ file: 'bundle.js', format: 'esm' }, | ||
{ | ||
file: 'bundle.es5.js', | ||
format: 'esm', | ||
plugins: [babel.generated({ presets: ['@babel/env'] })], | ||
}, | ||
], | ||
}; | ||
``` | ||
The `include`, `exclude` and `extensions` options are ignored when the when using `.generated()` will produce warnings, and there are a few more points to note that users should be aware of. | ||
You can also run the plugin twice on the code, once when processing the input files to transpile special syntax to JavaScript and once on the output to transpile to a lower compatibility target: | ||
```js | ||
// rollup.config.js | ||
import babel from 'rollup-plugin-babel'; | ||
export default { | ||
input: 'main.js', | ||
plugins: [babel({ presets: ['@babel/preset-react'] })], | ||
output: [ | ||
{ | ||
file: 'bundle.js', | ||
format: 'esm', | ||
plugins: [babel.generated({ presets: ['@babel/env'] })], | ||
}, | ||
], | ||
}; | ||
``` | ||
### Babel configuration files | ||
Unlike the regular `babel` plugin, `babel.generated(...)` will **not** automatically search for [Babel configuration files](https://babeljs.io/docs/en/config-files). Besides passing in Babel options directly, however, you can specify a configuration file manually via Babel's [`configFile`](https://babeljs.io/docs/en/options#configfile) option: | ||
```js | ||
babel.generated({ configFile: path.resolve(__dirname, 'babel.config.js') }); | ||
``` | ||
### Using formats other than ES modules or CommonJS | ||
As `babel.generated(...)` will run _after_ Rollup has done all its transformations, it needs to make sure it preserves the semantics of Rollup's output format. This is especially important for Babel plugins that add, modify or remove imports or exports, but also for other transformations that add new variables as they can accidentally become global variables depending on the format. Therefore it is recommended that for formats other than `esm` or `cjs`, you set Rollup to use the `esm` output format and let Babel handle the transformation to another format, e.g. via | ||
``` | ||
presets: [['@babel/env', { modules: 'umd' }], ...] | ||
``` | ||
to create a UMD/IIFE compatible output. If you want to use `babel.generated(...)` with other formats, you need to specify `allowAllFormats: true` as plugin option: | ||
```js | ||
rollup.rollup({...}) | ||
.then(bundle => bundle.generate({ | ||
format: 'iife', | ||
plugins: [babel.generated({ | ||
allowAllFormats: true, | ||
... | ||
})] | ||
})) | ||
``` | ||
### Injected helpers | ||
By default, helpers e.g. when transpiling classes will be inserted at the top of each chunk. In contrast to when applying this plugin on the input files, helpers will not be deduplicated across chunks. | ||
Alternatively, you can use imported runtime helpers by adding the `@babel/transform-runtime` plugin. This will make `@babel/runtime` an external dependency of your project, see [@babel/plugin-transform-runtime](https://babeljs.io/docs/en/babel-plugin-transform-runtime) for details. | ||
Note that this will only work for `esm` and `cjs` formats, and you need to make sure to set the `useESModules` option of `@babel/plugin-transform-runtime` to `true` if you create ESM output: | ||
```js | ||
rollup.rollup({...}) | ||
.then(bundle => bundle.generate({ | ||
format: 'esm', | ||
plugins: [babel.generated({ | ||
presets: ['@babel/env'], | ||
plugins: [['@babel/transform-runtime', { useESModules: true }]] | ||
})] | ||
})) | ||
``` | ||
```js | ||
// input | ||
export default class Foo {} | ||
// output | ||
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck'; | ||
var Foo = function Foo() { | ||
_classCallCheck(this, Foo); | ||
}; | ||
export default Foo; | ||
``` | ||
And for CommonJS: | ||
```js | ||
rollup.rollup({...}) | ||
.then(bundle => bundle.generate({ | ||
format: 'cjs', | ||
plugins: [babel.generated({ | ||
presets: ['@babel/env'], | ||
plugins: [['@babel/transform-runtime', { useESModules: false }]] | ||
})] | ||
})) | ||
``` | ||
```js | ||
// input | ||
export default class Foo {} | ||
// output | ||
('use strict'); | ||
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck'); | ||
var Foo = function Foo() { | ||
_classCallCheck(this, Foo); | ||
}; | ||
module.exports = Foo; | ||
``` | ||
Another option is to use `@babel/plugin-external-helpers`, which will reference the global `babelHelpers` object. It is your responsibility to make sure this global variable exists. | ||
## Configuring Babel 6 | ||
@@ -273,0 +145,0 @@ |
@@ -116,13 +116,20 @@ import * as babel from '@babel/core'; | ||
return transformCode(code, { ...babelOptions, filename }, overrides, customOptions, this, transformOptions => { | ||
if (!skipPreflightCheck) { | ||
preflightCheck(this, babelHelpers, transformOptions); | ||
} | ||
return transformCode( | ||
code, | ||
{ ...babelOptions, filename }, | ||
overrides, | ||
customOptions, | ||
this, | ||
async transformOptions => { | ||
if (!skipPreflightCheck) { | ||
await preflightCheck(this, babelHelpers, transformOptions); | ||
} | ||
if (babelHelpers === BUNDLED) { | ||
transformOptions = addBabelPlugin(transformOptions, bundledHelpersPlugin); | ||
} | ||
if (babelHelpers === BUNDLED) { | ||
transformOptions = addBabelPlugin(transformOptions, bundledHelpersPlugin); | ||
} | ||
return transformOptions; | ||
}); | ||
return transformOptions; | ||
}, | ||
); | ||
}, | ||
@@ -129,0 +136,0 @@ }; |
@@ -18,7 +18,12 @@ import * as babel from '@babel/core'; | ||
function fallbackClassTransform() { | ||
const PREFLIGHT_TEST_STRING = '__ROLLUP__PREFLIGHT_CHECK_DO_NOT_TOUCH__'; | ||
const PREFLIGHT_INPUT = `export default "${PREFLIGHT_TEST_STRING}";`; | ||
function helpersTestTransform() { | ||
return { | ||
visitor: { | ||
ClassDeclaration(path, state) { | ||
path.replaceWith(state.file.addHelper('inherits')); | ||
StringLiteral(path, state) { | ||
if (path.node.value === PREFLIGHT_TEST_STRING) { | ||
path.replaceWith(state.file.addHelper('inherits')); | ||
} | ||
}, | ||
@@ -29,4 +34,2 @@ }, | ||
const PREFLIGHT_INPUT = 'class Foo extends Bar {}\nexport default Foo;'; | ||
const mismatchError = (actual, expected, filename) => | ||
@@ -37,14 +40,8 @@ `You have declared using "${expected}" babelHelpers, but transforming ${filename} resulted in "${actual}". Please check your configuration.`; | ||
export default function preflightCheck(ctx, babelHelpers, transformOptions) { | ||
let check = babel.transformSync(PREFLIGHT_INPUT, transformOptions).code; | ||
export default async function preflightCheck(ctx, babelHelpers, transformOptions) { | ||
const finalOptions = addBabelPlugin(transformOptions, helpersTestTransform); | ||
const check = (await babel.transformAsync(PREFLIGHT_INPUT, finalOptions)).code; | ||
if (~check.indexOf('class ')) { | ||
check = babel.transformSync(PREFLIGHT_INPUT, addBabelPlugin(transformOptions, fallbackClassTransform)).code; | ||
} | ||
if ( | ||
!~check.indexOf('export default') && | ||
!~check.indexOf('export default Foo') && | ||
!~check.indexOf('export { Foo as default }') | ||
) { | ||
// Babel sometimes splits ExportDefaultDeclaration into 2 statements, so we also check for ExportNamedDeclaration | ||
if (!/export (d|{)/.test(check)) { | ||
ctx.error(MODULE_ERROR); | ||
@@ -60,3 +57,3 @@ } | ||
if (~check.indexOf('babelHelpers.inherits')) { | ||
if (check.includes('babelHelpers.inherits')) { | ||
if (babelHelpers === EXTERNAL) { | ||
@@ -68,3 +65,4 @@ return; | ||
if (~check.indexOf('function _inherits')) { | ||
// test unminifiable string content | ||
if (check.includes('Super expression must either be null or a function')) { | ||
if (babelHelpers === INLINE || babelHelpers === BUNDLED) { | ||
@@ -74,5 +72,3 @@ return; | ||
if (babelHelpers === RUNTIME && !transformOptions.plugins.length) { | ||
ctx.error( | ||
`You must use the \`@babel/plugin-transform-runtime\` plugin when \`babelHelpers\` is "${RUNTIME}", but you have configured no babel plugins.\n`, | ||
); | ||
ctx.error(`You must use the \`@babel/plugin-transform-runtime\` plugin when \`babelHelpers\` is "${RUNTIME}".\n`); | ||
} | ||
@@ -79,0 +75,0 @@ ctx.error(mismatchError(INLINE, babelHelpers, transformOptions.filename)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
927
0
96111
228