SOLFIND
Web Lens
Portal home

@babel/plugin-proposal-import-attributes-to-assertions · Babel

https://babeljs.io/docs/babel-plugin-proposal-import-attributes-to-assertions • 27 KB fetched
Open original page


@babel/plugin-proposal-import-attributes-to-assertions · Babel Skip to main content Docs Setup Try it out Videos Blog Search Donate Team GitHub * Modules * TC39 Proposals * Web Compatibility * import-attributes-to-assertions * * Web Compatibility * import-attributes-to-assertions On this page @babel/plugin-proposal-import-attributes-to-assertions caution This plugin will generate code that is not compatible with the current ECMAScript specification or with any currently proposed addition to it. Only use it when you are shipping native ES modules and you need compatibility exclusively with tools that don't support the Import Attributes syntax ( import pkg from "./package.json" with { type: "json" } ) but support the old Import Assertions syntax ( import pkg from "./package.json" assert { type: "json" } ), such as Chrome 91 - 122 and Node.js ^16.14 || ^18 || ^20 < 20.10 . Installation ​ * npm * Yarn * pnpm * Bun npm install --save-dev @babel/plugin-proposal-import-attributes-to-assertions yarn add --dev @babel/plugin-proposal-import-attributes-to-assertions pnpm add --save-dev @babel/plugin-proposal-import-attributes-to-assertions bun add --dev @babel/plugin-proposal-import-attributes-to-assertions Usage ​ With a configuration file (Recommended) ​ babel.config.json { "plugins" : [ "@babel/plugin-proposal-import-attributes-to-assertions" ] } Via CLI ​ Shell babel --plugins @babel/plugin-proposal-import-attributes-to-assertions script.js Via Node API ​ JavaScript require ( "@babel/core" ) . transformSync ( "code" , { plugins : [ "@babel/plugin-proposal-import-attributes-to-assertions" ] , } ) ; Edit this page Previous syntax-module-blocks * Installation * Usage * With a configuration file (Recommended) * Via CLI * Via Node API Docs * Learn ES2015 Community * Videos * User Showcase * Stack Overflow * Slack Channel * X (Twitter) * Bluesky More * Blog * GitHub Org * GitHub Repo * Website Repo * Old 7.x Site * Old 6.x Site * Old 5.x Site

Links found on this page

  1. Skip to main content [direct]
  2. Docs [direct]
  3. Setup [direct]
  4. Try it out [direct]
  5. Videos [direct]
  6. Blog [direct]
  7. Donate [direct]
  8. Team [direct]
  9. GitHub [direct]
  10. Modules [direct]
  11. TC39 Proposals [direct]
  12. Edit this page [direct]
  13. Previous syntax-module-blocks [direct]
  14. Learn ES2015 [direct]
  15. User Showcase [direct]
  16. Stack Overflow [direct]
  17. Slack Channel [direct]
  18. X (Twitter) [direct]
  19. Bluesky [direct]
  20. GitHub Org [direct]
  21. Website Repo [direct]
  22. Old 7.x Site [direct]
  23. Old 6.x Site [direct]
  24. Old 5.x Site [direct]