Skip to content

Commit 8eeaf03

Browse files
committed
Expand the documentation for webpack-deep-imports-compat-plugin.
1 parent bb8a588 commit 8eeaf03

File tree

1 file changed

+13
-0
lines changed
  • webpack/webpack-deep-imports-compat-plugin

1 file changed

+13
-0
lines changed

webpack/webpack-deep-imports-compat-plugin/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ addition to the package's `main` entrypoint), but you don't want to pay the cost
88
this plugin can be used to create a Webpack bundle that maintains compatibility with the paths to the
99
existing loose files.
1010

11+
This enables a couple common use cases:
12+
13+
- **Calling internal APIs:** SemVer compatibility guarantees may only apply to official public APIs,
14+
which are typically top-exports of the package's `main` module. However, in situations where
15+
certain functionality has not yet been exposed as a public API, consumers may find it expedient
16+
to use deep imports to access library internals, with the understanding that bypassing the
17+
API contract is done "at your own risk".
18+
19+
- **Unit test mocking:** Library APIs often neglect to expose interfaces needed for
20+
testability, such as intercepting network or disk operations. In order to write proper
21+
unit tests, it may be necessary to mock the library's internals. Deep imports provide
22+
a convenient way for tests to replace internal library modules with mock implementations.
23+
1124
This plugin is based on the built-in Webpack `DllPlugin`.
1225

1326
## Usage

0 commit comments

Comments
 (0)