Skip to content

'@babel/plugin-transform-runtime' did not delete the import of 'regenerator-runtime/runtime.js' #12601

Answered by nicolo-ribaudo
myNameIsDu asked this question in Q&A
Discussion options

You must be logged in to vote

First of all, even if there are multiple imports/requires to regenerator is not a problem: they all internally delegate to the same file, so it's not 7.3KB + 7.3KB + 7.2KB but just 7.3KB.

However, you can avoid the multiple imports by using babel-plugin-polyfill-corejs3 instead of the useBuiltIns option of @babel/preset-env. This will be the recommended way starting from Babel 8, but you can already use it now:

{
	"presets": [
		["@babel/preset-env", {
			"modules": false,
			"targets": {
				"edge": "17",
				"firefox": "60",
				"chrome": "50",
				"safari": "11.1",
				"ie": "11"
			}
		}]
	],
	"plugins": [
		"@babel/plugin-transform-runtime",
		["@babel/plugin-proposal-decorators", { "…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@JackHowa
Comment options

@myNameIsDu
Comment options

Comment options

You must be logged in to vote
1 reply
@myNameIsDu
Comment options

Answer selected by myNameIsDu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants