Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"remark-emoji": "^2.2.0",
"remark-extract-anchors": "1.1.1",
"remark-frontmatter": "^3.0.0",
"remark-gfm": "^1.0.0",
"remark-gfm": "^3.0.1",
"remark-html": "^13.0.0",
"remark-refractor": "montogeek/remark-refractor",
"remark-slug": "^6.1.0",
Expand Down
3 changes: 3 additions & 0 deletions src/content/plugins/normal-module-replacement-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: webpack
contributors:
- gonzoyumo
- byzyk
- chenxsan
---

The `NormalModuleReplacementPlugin` allows you to replace resources that match `resourceRegExp` with `newResource`. If `newResource` is relative, it is resolved relative to the previous resource. If `newResource` is a function, it is expected to overwrite the request attribute of the supplied resource.
Expand All @@ -14,6 +15,8 @@ This can be useful for allowing different behaviour between builds.
new webpack.NormalModuleReplacementPlugin(resourceRegExp, newResource);
```

Note that the `resourceRegExp` is tested against the request you write in your code, not the resolved resource. For instance, `'./sum'` will be used to test instead of `./sum.js` when you have code `import sum from './sum'`.

## Basic Example

Replace a specific module when building for a [development environment](/guides/production).
Expand Down
Loading