Webpack: Question : Can a relative path be the key for resolve.alias ?

Created on 10 Apr 2015  路  3Comments  路  Source: webpack/webpack

I am trying to use resolve.alias for resolving relative modules, like

 require('./moduleA')

So my config looks like this :

{
    resolve : {
       alias : { 
           moduleA$ : 'path/to/replacement/module' 
      } 
   }
}

This doesnt seem to work.
But if require contains a module name like :

 require('moduleA')

This works

Is there support for relative modules in require?

Thanks

question

Most helpful comment

Welp, ended up using webpack.NormalModuleReplacementPlugin

All 3 comments

:+1: Looking for that too!

I am trying to override react/lib/invariant (mostly due to https://github.com/facebook/react/issues/2686) but in React src, they all require it like './react' so it is impossible to replace it. Any suggestions?

Welp, ended up using webpack.NormalModuleReplacementPlugin

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IngwiePhoenix picture IngwiePhoenix  路  3Comments

Tjorriemorrie picture Tjorriemorrie  路  3Comments

zerkalica picture zerkalica  路  3Comments

olalonde picture olalonde  路  3Comments

natew picture natew  路  3Comments