New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webpack-resolve-in-paths-plugin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-resolve-in-paths-plugin

[![Coverage Status](https://coveralls.io/repos/github/dimanech/webpack-resolve-in-paths-plugin/badge.svg?branch=master)](https://coveralls.io/github/dimanech/webpack-resolve-in-paths-plugin?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.i

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

webpack-resolve-in-paths-plugin

Coverage Status Greenkeeper badge Known Vulnerabilities npm version

This resolver aimed to overlap imports from different directories.

It is helping to overload some translations, components files in some application part without explicitly modify imports paths.

It acts similar to "fallback paths" - if path not resolved in current scope, resolver try to resolve in next defined path until found the resolution. Context of imports never changes.

Ex:

"component" <- required "./component/extension" <- required "./component/base/base"

imagine that on brand we need to modify "extension" or even "base" of component.

We could place './component/extension' file in brand cartridge and during the build our brand-level "extension" would be picked up instead of core-level extension.

As the result brand could modify some component in the middle of dependency chain, without overloading all child peers. It is not very good practice, but some times we do not have any chance to do it differently.

Based on https://www.npmjs.com/package/webpack-fallback-directory-resolver-plugin

Getting started

$ npm install webpack-resolve-in-paths --save-dev

webpack.config.js

const ResolveInPaths = require('webpack-resolve-in-paths-plugin');

module.exports = {
   // ...
   resolve: {
       plugins: [
           new ResolveInPaths({paths: [
               path.resolve(__dirname, 'brand/js'),
               path.resolve(__dirname, 'core/js')
           ]})
       ]
   }
}

Imports in components always should be relative to components root

import c from "./components/c.js"; // instead of "./c.js"

It would be great if we could deal with imports transparently, but as most simple solution it use explicit relative to components root paths.

Licence

Copyright © 2020, D. Nechepurenko. Published under MIT license.

Keywords

FAQs

Package last updated on 01 May 2020

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