Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/content/configuration/resolve.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ contributors:
- EugeneHlushko
- Aghassi
- myshov
- niravasher
---

These options change how modules are resolved. webpack provides reasonable defaults, but it is possible to change the resolving in detail. Have a look at [Module Resolution](/concepts/module-resolution) for more explanation of how the resolver works.
Expand All @@ -39,7 +40,7 @@ module.exports = {

### `resolve.alias`

`object`
`object` `[string]` `boolean: false`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't take a string as a value I guess. Please check its key : value pair

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant
resolve.alias[key] : [string] / false ? if so, please change the docs accordingly


Create aliases to `import` or `require` certain modules more easily. For example, to alias a bunch of commonly used `src/` folders:

Expand Down Expand Up @@ -115,6 +116,32 @@ The following table explains other cases:

W> `resolve.alias` takes precedence over other module resolutions.

W> `[string]` and `false` values are supported since webpack 5.0.0

```js
module.exports = {
//...
resolve: {
alias: {
_: [path.resolve(__dirname, 'src/utilities/'), path.resolve(__dirname, 'src/templates/')]
}
}
};
```

Setting `resolve.alias` to `false` will tell webpack to ignore a module.

```js
module.exports = {
//...
resolve: {
alias: {
'ignored-module': false,
}
}
};
```


### `resolve.aliasFields`

Expand Down