Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
esbuild-plugin-alias-path
Advanced tools
ESBuild plugin for alias path replacement.
npm install esbuild-plugin-alias-path --save-dev
pnpm install esbuild-plugin-alias-path --save-dev
yarn add esbuild-plugin-alias-path --save-dev
import { build } from 'esbuild';
import { aliasPath } from 'esbuild-plugin-alias-path';
(async () => {
const res = await build({
entryPoints: ['./src/main.ts'],
bundle: true,
outfile: './dist/main.js',
plugins: [
aliasPath({
alias: { '@foo': './src/alias/foo.ts' },
}),
],
});
})();
// src/main.ts
import { FOO } from '@foo';
console.log(FOO);
// src/alias/foo.ts
export const FOO = 'foo';
// Output dist/main.js
import { FOO } from './src/alias/foo.ts';
You can also use syntax *
like @alias/*
, this will explore all the files in the directory and replace the path.
Use
@alias/*
instead of@alias/**/*
aliasPath({
alias: {
'@alias/*': path.resolve(__dirname, './src/alias'),
},
});
For example:
|- alias
|- |- foo.ts
|-- nested
|-- |- bar.ts
Will be replaced to:
@alias/foo.ts -> ./src/alias/foo.ts
@alias/nested/bar.ts -> ./src/alias/nested/bar.ts
NOTE: In TypeScript project, compilerOptions.paths
in tsconfig.json
will be used by ESBuild automatically, so you will need this plugin only when you're going to replace the alias dynamically.
FAQs
ESBuild plugin for alias path.
The npm package esbuild-plugin-alias-path receives a total of 4,915 weekly downloads. As such, esbuild-plugin-alias-path popularity was classified as popular.
We found that esbuild-plugin-alias-path 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.