Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
tsconfig-paths-webpack-plugin
Advanced tools
The tsconfig-paths-webpack-plugin is a plugin for webpack that allows you to leverage the paths defined in your tsconfig.json file. This means you can alias paths in your TypeScript code and have those aliases correctly resolved by webpack when bundling your application. It simplifies the module resolution process when using TypeScript with webpack.
Path Resolution
This feature allows webpack to resolve paths based on the aliases defined in the tsconfig.json file. The code sample shows how to include the TsconfigPathsPlugin in your webpack configuration.
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
module.exports = {
// ... other webpack config settings ...
resolve: {
plugins: [
new TsconfigPathsPlugin({ configFile: './path/to/tsconfig.json' })
]
}
};
This Babel plugin allows you to add new 'root' directories that contain your modules. It also allows you to map a path to another and to safely ignore certain modules during the Babel process. It's similar to tsconfig-paths-webpack-plugin but is used in the context of Babel rather than webpack.
This is the library that webpack uses under the hood for resolving modules. It can be used directly in Node.js projects to resolve files or directories using webpack's resolution algorithm. It's more low-level compared to tsconfig-paths-webpack-plugin and doesn't directly use the tsconfig.json file.
Aliasify is a transform for Browserify that lets you rewrite module calls in your browserify project. This can be used to alias module paths similar to what tsconfig-paths-webpack-plugin does for webpack, but it's specific to Browserify.
Use this to load modules whose location is specified in the paths
section of tsconfig.json
when using webpack.
yarn add --dev tsconfig-paths-webpack-plugin
or
npm install --save-dev tsconfig-paths-webpack-plugin
In your webpack config add this:
var TsConfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
resolve: {
plugins: [
new TsConfigPathsPlugin(/* { configFileName: "path/to/tsconfig.json" } */)
]
}
To run the provided example:
yarn example
This project uses work done in the awesome-typescript-loader.
FAQs
Load modules according to tsconfig paths in webpack.
The npm package tsconfig-paths-webpack-plugin receives a total of 4,683,101 weekly downloads. As such, tsconfig-paths-webpack-plugin popularity was classified as popular.
We found that tsconfig-paths-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.