@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
- Skip to main content [direct]
- Docs [direct]
- Setup [direct]
- Try it out [direct]
- Videos [direct]
- Blog [direct]
- Donate [direct]
- Team [direct]
- GitHub [direct]
- Modules [direct]
- TC39 Proposals [direct]
- Edit this page [direct]
- Previous syntax-module-blocks [direct]
- Learn ES2015 [direct]
- User Showcase [direct]
- Stack Overflow [direct]
- Slack Channel [direct]
- X (Twitter) [direct]
- Bluesky [direct]
- GitHub Org [direct]
- Website Repo [direct]
- Old 7.x Site [direct]
- Old 6.x Site [direct]
- Old 5.x Site [direct]
|
|