Skip to content

Commit 8803aee

Browse files
committed
docs(readme): add more detail about configuring webpack for ESM
1 parent 7e8436b commit 8803aee

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ yarn add --dev resolve-typescript-plugin
4747

4848
## Usage
4949

50-
Configure webpack something like this:
50+
Include the following in `package.json` to configure your project to be an ES
51+
Module:
52+
53+
```json
54+
{
55+
"type": "module"
56+
}
57+
```
58+
59+
Include something like the following in `webpack.config.js`:
5160

5261
```js
5362
const ResolveTypeScriptPlugin = require("resolve-typescript-plugin").default;
@@ -71,6 +80,13 @@ exports = {
7180
You will also need to have [ts-loader][4] (or another TypeScript loader)
7281
installed and configured.
7382

83+
The `resolve.fullySpecified` option configures webpack to require file
84+
extensions except when importing external modules by name. This is consistent
85+
with node's implementation of ES Modules.
86+
87+
If you set `resolve.fullySpecified` you should also delete the
88+
`resolve.extensions` option, if any.
89+
7490
## Feedback
7591

7692
We're seeking [community feedback][5] on this plugin.

0 commit comments

Comments
 (0)