You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

esm-loader-import-alias

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esm-loader-import-alias

Chainable ESModule Loader for Import Path Aliases

0.0.2
Source
npmnpm
Version published
Weekly downloads
64
52.38%
Maintainers
1
Weekly downloads
 
Created
Source

esm-loader-import-alias

Node.js ESModule Loader for rewriting import path aliases.

Warning! Using experimental Node.js features and flags, API will likely change. This may be helpful for development and testing, but should not be used in production.

Usage

Chainable

This loader can be configured, and chained with other loaders, using node-esm-loader.

npm install --save-dev esm-loader-import-alias node-esm-loader
// .loaderrc.js
import { resolve } from 'path'

export default {
  loaders: [
    {
      loader: 'esm-loader-import-alias',
      options: {
        aliases: {
          // SvelteKit $lib import path alias example
          '$lib/': `${resolve('src/lib/')}/`,
        },
      },
    },
  ],
}
// index.js
import Component from '$lib/Component.js'
NODE_OPTIONS="--experimental-loader node-esm-loader" node index.js

Option: Debug

// .loaderrc.js
export default {
  loaders: [
    {
      loader: 'esm-loader-import-alias',
      options: {
        debug: true,
      },
    },
  ],
}

License

MIT

Keywords

esm

FAQs

Package last updated on 09 Feb 2022

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.