Socket
Socket
Sign inDemoInstall

@babel/helper-module-imports

Package Overview
Dependencies
4
Maintainers
4
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @babel/helper-module-imports

Babel helper functions for inserting module loads


Version published
Maintainers
4
Install size
2.11 MB
Created

Package description

What is @babel/helper-module-imports?

The @babel/helper-module-imports package is a utility that allows Babel plugins to add module imports to a file in a consistent way. It provides functions to programmatically add import statements or require calls within the code being transformed by Babel.

What are @babel/helper-module-imports's main functionalities?

addDefault

Adds a default import statement to the file. For example, it can add `import lodash from 'lodash';` to the code.

import { addDefault } from '@babel/helper-module-imports';
const path = /* ... */;
const imported = addDefault(path, 'lodash', { nameHint: 'lodash' });

addNamed

Adds a named import statement to the file. For example, it can add `import { map } from 'lodash';` to the code.

import { addNamed } from '@babel/helper-module-imports';
const path = /* ... */;
const imported = addNamed(path, 'map', 'lodash', { nameHint: 'map' });

addNamespace

Adds a namespace import statement to the file. For example, it can add `import * as lodash from 'lodash';` to the code.

import { addNamespace } from '@babel/helper-module-imports';
const path = /* ... */;
const imported = addNamespace(path, 'lodash', { nameHint: 'lodash' });

addSideEffect

Adds an import statement that will include a module for its side effects only, without importing any bindings. For example, it can add `import 'normalize.css';` to the code.

import { addSideEffect } from '@babel/helper-module-imports';
const path = /* ... */;
addSideEffect(path, 'normalize.css');

Other packages similar to @babel/helper-module-imports

Readme

Source

@babel/helper-module-imports

Babel helper functions for inserting module loads

See our website @babel/helper-module-imports for more information.

Install

Using npm:

npm install --save @babel/helper-module-imports

or using yarn:

yarn add @babel/helper-module-imports

FAQs

Last updated on 04 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc