Skip to content

Replace the deprecated produceCachedData option used in vm module with script.createCachedData()#13741

Merged
nicolo-ribaudo merged 2 commits intobabel:mainfrom
wafuwafu13:replace-vm-option
Sep 11, 2021
Merged

Replace the deprecated produceCachedData option used in vm module with script.createCachedData()#13741
nicolo-ribaudo merged 2 commits intobabel:mainfrom
wafuwafu13:replace-vm-option

Conversation

@wafuwafu13
Copy link
Copy Markdown
Contributor

@wafuwafu13 wafuwafu13 commented Sep 9, 2021

Q                       A
License MIT

https://nodejs.org/api/vm.html#vm_class_vm_script

The produceCachedData is deprecated in favour of script.createCachedData() from 10.6.0

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Sep 9, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/48632/

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Sep 9, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 063e1ba:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@wafuwafu13
Copy link
Copy Markdown
Contributor Author

I'm investigating why the test is failing.
https://github.com/babel/babel/pull/13741/checks?check_run_id=3554626091

TypeError: script.createCachedData is not a function

@nicolo-ribaudo
Copy link
Copy Markdown
Member

Babel still supports Node.js 6, but script.createCachedData() has been introduced in Node.js 10.

You could do something like this:

if (process.env.BABEL_8_BREAKING) {
  // Use script.createCachedData()
} else {
  // Use produceCachedData
}

So that createCachedData will be used in Babel 8, which will require Node.js 12+.

@nicolo-ribaudo nicolo-ribaudo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Sep 10, 2021
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The CI failure is not related.

@nicolo-ribaudo nicolo-ribaudo merged commit 9780c56 into babel:main Sep 11, 2021
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants