
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
esm-loader-import-alias
Advanced tools
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.
Some frameworks will allow aliases in import paths ($lib
). This loader helps
Node.js handle these aliases:
import { tool } from '$lib/utils.js'
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 'node: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 >= 20.7
NODE_OPTIONS="--import node-esm-loader/register" node index.js
# node < 20.7
NODE_OPTIONS="--loader node-esm-loader" node index.js
See example above.
// .loaderrc.js
export default {
loaders: [
{
loader: 'esm-loader-import-alias',
options: {
debug: true,
},
},
],
}
In your loader chain:
FAQs
Chainable ESModule Loader for import path aliases
The npm package esm-loader-import-alias receives a total of 38 weekly downloads. As such, esm-loader-import-alias popularity was classified as not popular.
We found that esm-loader-import-alias demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.