Socket
Socket
Sign inDemoInstall

babel-plugin-module-resolver

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-module-resolver

Module resolver plugin for Babel


Version published
Weekly downloads
2.4M
decreased by-3.21%
Maintainers
2
Weekly downloads
 
Created

What is babel-plugin-module-resolver?

The babel-plugin-module-resolver npm package allows you to customize the resolution of modules in your Babel projects. It can be used to alias paths, so you don't have to deal with relative paths, and it can also help in organizing the project's structure more logically from a developer's perspective.

What are babel-plugin-module-resolver's main functionalities?

Custom Aliases

This feature allows you to define custom aliases for directories within your project. Instead of using relative paths, you can use the aliases to require modules, making the code cleaner and easier to maintain.

{
  "plugins": [
    ["module-resolver", {
      "alias": {
        "@app": "./src/app",
        "@models": "./src/models"
      }
    }]
  ]
}

Extension Resolution

This feature enables you to specify which file extensions should be resolved by the plugin. This can be useful when you are working with different types of JavaScript files and want to import them without specifying the extension.

{
  "plugins": [
    ["module-resolver", {
      "extensions": [
        ".js",
        ".jsx"
      ]
    }]
  ]
}

Root Directory Configuration

By setting a root directory, you can simplify the import statements in your project. This feature allows you to set a base directory from which all the modules will be resolved.

{
  "plugins": [
    ["module-resolver", {
      "root": ["./src"]
    }]
  ]
}

Other packages similar to babel-plugin-module-resolver

Keywords

FAQs

Package last updated on 18 Apr 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc