Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

eslint-import-resolver-webpack

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-import-resolver-webpack

Resolve paths to dependencies, given a webpack.config.js. Plugin for eslint-plugin-import.

latest
Source
npmnpm
Version
0.13.10
Version published
Weekly downloads
1.1M
1.71%
Maintainers
3
Weekly downloads
 
Created
Source

eslint-import-resolver-webpack

npm

Webpack-literate module resolution plugin for eslint-plugin-import.

:boom: Only "synchronous" Webpack configs are supported at the moment. If your config returns a Promise, this will cause problems. Consider splitting your asynchronous configuration to a separate config.

Published separately to allow pegging to a specific version in case of breaking changes.

To use with eslint-plugin-import, run:

npm i eslint-import-resolver-webpack -g

or if you manage ESLint as a dev dependency:

# inside your project's working tree
npm install eslint-import-resolver-webpack --save-dev

Will look for webpack.config.js as a sibling of the first ancestral package.json, or a config parameter may be provided with another filename/path either relative to the package.json, or a complete, absolute path.

If multiple webpack configurations are found the first configuration containing a resolve section will be used. Optionally, the config-index (zero-based) setting can be used to select a specific configuration.

---
settings:
  import/resolver: webpack  # take all defaults

or with explicit config file name:

---
settings:
  import/resolver:
    webpack:
      config: 'webpack.dev.config.js'

or with explicit config file index:

---
settings:
  import/resolver:
    webpack:
      config: 'webpack.multiple.config.js'
      config-index: 1   # take the config at index 1

or with explicit config file path relative to your projects's working directory:

---
settings:
  import/resolver:
    webpack:
      config: './configs/webpack.dev.config.js'

or with explicit config object:

---
settings:
  import/resolver:
    webpack:
      config:
        resolve:
          extensions:
            - .js
            - .jsx

If your config relies on environment variables, they can be specified using the env parameter. If your config is a function, it will be invoked with the value assigned to env:

---
settings:
  import/resolver:
    webpack:
      config: 'webpack.config.js'
      env:
        NODE_ENV: 'local'
        production: true

If your config is set as a function, it will be evaluated at every resolution. You have an option to prevent this by caching it using the cache parameter:

---
settings:
  import/resolver:
    webpack:
      config: 'webpack.config.js'
      cache: true

Support

Get supported eslint-import-resolver-webpack with the Tidelift Subscription

Keywords

eslint-plugin-import

FAQs

Package last updated on 11 Dec 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