question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable import.meta by default in @babel/parser

See original GitHub issue

Feature Request

<div align="center">

import.meta is Stage 4!

</div>

This means that it should be enabled by default in @babel/parser 🎉

It should be done similarly to this commit: https://github.com/babel/babel/commit/c3388ea42f3ec2d9614503fd0eff81b679ba12a7

  1. Remove all the this.hasPlugin and this.expectPlugin checks related to importMeta in packages/babel-parser/src
  2. Remove all the usages of importMeta in @babel/parser’s tests
  3. Probably there is a test to ensure that the plugin is required; it can be removed.
  4. Move the tests from the experimental folder to es2020
  5. PR! 🎉

If it is the first time that you contribute to Babel, follow these steps: (you need to have make and yarn available on your machine)

  1. Write a comment there to let other possible contributors know that you are working on this bug.
  2. Fork the repo
  3. Run git clone https://github.com/<YOUR_USERNAME>/babel.git && cd babel
  4. Run yarn && make bootstrap
  5. Wait ⏳
  6. Run make watch (or make build whenever you change a file)
  7. Add a test if needed (only input.js; output.js will be automatically generated)
  8. Update the code!
  9. yarn jest babel-parser to run the tests
    • If some test outputs don’t match but the new results are correct, you can delete the bad output.js files and run the tests again
    • If you prefer, you can run OVERWRITE=true yarn jest babel-parser and they will be automatically updated.
  10. If it is working, run yarn jest to run all the tests
  11. Run git push and open a PR!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
existentialismcommented, Apr 2, 2020

@Wetinee thanks! 🙏

0reactions
pustovalovcommented, Apr 3, 2020

Also would like to give it a try

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/plugin-syntax-import-meta
NOTE**: This plugin is included in `@babel/preset-env`, in [ES2020](https://github.com/tc39/proposals/blob/master/finished-proposals.md)
Read more >
How to use the @babel/plugin-syntax-import-meta.default ...
To help you get started, we've selected a few @babel/plugin-syntax-import-meta.default examples, based on popular ways it is used in public projects.
Read more >
How to enable import assertions for Babel? - Stack Overflow
react-scripts doesn't load babel configuration by default. Install the following packages npm i -D customize-cra react-app-rewired.
Read more >
babel-plugin-transform-import-meta | Yarn - Package Manager
babel -plugin-transform-import-meta. Transforms import.meta for nodejs environments. This plugin replaces any occurrence of import.meta.url .
Read more >
babel-plugin-transform-import-meta - npm
Transforms import.meta for nodejs environments. Latest version: 2.2.0, last published: 6 months ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found