Socket
Socket
Sign inDemoInstall

@module-federation/dts-plugin

Package Overview
Dependencies
Maintainers
0
Versions
324
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/dts-plugin


Version published
Weekly downloads
526K
increased by15.08%
Maintainers
0
Weekly downloads
 
Created

What is @module-federation/dts-plugin?

@module-federation/dts-plugin is a plugin designed to generate TypeScript declaration files (d.ts) for federated modules. It helps in creating type definitions for modules that are shared across different applications using Module Federation, ensuring type safety and better developer experience.

What are @module-federation/dts-plugin's main functionalities?

Generate TypeScript Declarations

This feature allows you to generate TypeScript declaration files for your federated modules. By configuring the DtsPlugin with the necessary options, you can ensure that your shared components have the appropriate type definitions.

const { DtsPlugin } = require('@module-federation/dts-plugin');

module.exports = {
  plugins: [
    new DtsPlugin({
      name: 'my-federated-module',
      filename: 'remoteEntry.js',
      exposes: {
        './Component': './src/Component',
      },
    }),
  ],
};

Custom Output Directory

This feature allows you to specify a custom output directory for the generated TypeScript declaration files. By setting the `outputDir` option, you can control where the type definitions are saved.

const { DtsPlugin } = require('@module-federation/dts-plugin');

module.exports = {
  plugins: [
    new DtsPlugin({
      name: 'my-federated-module',
      filename: 'remoteEntry.js',
      exposes: {
        './Component': './src/Component',
      },
      outputDir: 'types',
    }),
  ],
};

TypeScript Configuration

This feature allows you to specify a custom TypeScript configuration file for generating the declaration files. By setting the `tsConfigFile` option, you can ensure that the TypeScript compiler uses the correct settings.

const { DtsPlugin } = require('@module-federation/dts-plugin');

module.exports = {
  plugins: [
    new DtsPlugin({
      name: 'my-federated-module',
      filename: 'remoteEntry.js',
      exposes: {
        './Component': './src/Component',
      },
      tsConfigFile: 'tsconfig.json',
    }),
  ],
};

Other packages similar to @module-federation/dts-plugin

FAQs

Package last updated on 22 Jul 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