🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

hoist-peers-webpack-resolve-plugin

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hoist-peers-webpack-resolve-plugin

use hoisting dep's peerDependencies even though already existing in dep's node_modules

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Hoist-Peers-Webpack-Resolve-Plugin

use hoisting dep's peerDependencies even though already existing in dep's node_modules

English | 简体中文

Install

npm i hoist-peers-webpack-resolve-plugin --save-dev

Usage

using webpack.config.js

// webpack.config.js

// ...
const { HoistPeersWebpackResolvePlugin } = require('hoist-peers-webpack-resolve-plugin');

module.exports = {
  // ...
  resolve: {
    // ...
    plugins: [
      // ...
      new HoistPeersWebpackResolvePlugin({ deps: ['your-npm-link-dep-name'] })
    ]
  },
  // ...
}

using webpack-chain

// webpack.config.js

// ...
const Config = require('webpack-chain');
const { HoistPeersWebpackResolvePlugin } = require('hoist-peers-webpack-resolve-plugin');

// ...
const config = new Config();

// ...
config.resolve
  .plugin('HoistPeersWebpackResolvePlugin')
    .use(HoistPeersWebpackResolvePlugin, [{ deps: ['@apaas/common'] }]);

// ...

module.exports = config.toConfig();

Tips: more options see webpack-chain.

Options

deps

  • type: string[]
  • required: true
  • desc: dependences's names which peers need to be force hoisted.
  • examples:
      new HoistPeersWebpackResolvePlugin({ deps: ['lodash'] });
    

options

  • type: object
  • required: false
  • desc: polyfills for webpack v4. (only works in webpack v4)
  • example:
      new HoistPeersWebpackResolvePlugin({
        deps: ['lodash'],
        {
          symlinks: true,
          modules: [path.join(__dirname, './node_modules')],
          roots: [path.join(__dirname)],
        }
      });
    

options.modules

  • type: string[]
  • required: true (if in webpack v4)
  • desc: the same option of webpack config config.resolve.modules.
  • tips: must be absolute path.

options.roots

  • type: string[]
  • required: true (if in webpack v4)
  • desc: the same option of webpack config config.resolve.roots.
  • tips: must be absolute path.

Keywords

hoist peers

FAQs

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