Skip to content
This repository was archived by the owner on Aug 8, 2019. It is now read-only.
This repository was archived by the owner on Aug 8, 2019. It is now read-only.

How to resolve loader in webpack 4? #113

@pnepe6

Description

@pnepe6

Using webpack version 4.6.0

I need to resolve the path of a loader using webpack.

The loader is used like this in a node_modules dependency:

const loadedIndex = require('!!../loaders/A-loader!./index.js');

I want to override this loader A-loader with another B-loader.

Here is how my project is structured:

_ directory
  |_ node_modules
     |_ lib
        |_ loaders/A-loader.js
        |_ index.js
  |_ loaders/B-loader.js

I want to use webpack resolveLoader in order to replace the current A-loader into B-loader.

I'm not sure how to use it, i try but this doesn't work:

{
    resolveLoader {
          alias: { 
               'A-loader': 'path/to/my/directory/loaders/B-loaders.js'
          } 
    }
}

Does anybody know how can I solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions