Skip to content

Commit

Permalink
Update doc: add known incompatible tools
Browse files Browse the repository at this point in the history
- Closes #81
  • Loading branch information
Kehrlann committed Nov 12, 2019
1 parent c82d4bb commit 2a62eb3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ module.exports = {
}
```

More details on the [official documentation](https://webpack.js.org/configuration/resolve).

## Known incompatibilities

This module does not play well with:

- [Jest](https://jestjs.io), which discards node's module system entirely to use it's own module system, bypassing module-alias.
- All kinds of front-end frameworks (React, Vue, ...), as they tend to use Webpack. Use Webpack's [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealias) mechanism instead.
- The [NCC compiler](https://github.com/zeit/ncc), as it uses WebPack under the hood without exposing properties, such as resolve.alias. It is not [something they wish to do](https://github.com/zeit/ncc/pull/460).

## How it works?

In order to register an alias it modifies the internal `Module._resolveFilename` method so that when you use `require` or `import` it first checks whether the given string starts with one of the registered aliases, if so, it replaces the alias in the string with the target path of the alias.
Expand Down

0 comments on commit 2a62eb3

Please sign in to comment.