@rollup/plugin-node-resolve 15.1.0 → 15.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/dist/cjs/index.js +340 -265
- package/dist/es/index.js +340 -265
- package/package.json +1 -1
- package/types/index.d.ts +8 -0
package/README.md
CHANGED
@@ -175,6 +175,31 @@ rootDir: path.join(process.cwd(), '..')
|
|
175
175
|
|
176
176
|
If you use the `sideEffects` property in the package.json, by default this is respected for files in the root package. Set to `true` to ignore the `sideEffects` configuration for the root package.
|
177
177
|
|
178
|
+
### `allowExportsFolderMapping`
|
179
|
+
|
180
|
+
Older Node versions supported exports mappings of folders like
|
181
|
+
|
182
|
+
```json
|
183
|
+
{
|
184
|
+
"exports": {
|
185
|
+
"./foo/": "./dist/foo/"
|
186
|
+
}
|
187
|
+
}
|
188
|
+
```
|
189
|
+
|
190
|
+
This was deprecated with Node 14 and removed in Node 17, instead it is recommended to use exports patterns like
|
191
|
+
|
192
|
+
```json
|
193
|
+
{
|
194
|
+
"exports": {
|
195
|
+
"./foo/*": "./dist/foo/*"
|
196
|
+
}
|
197
|
+
}
|
198
|
+
```
|
199
|
+
|
200
|
+
But for backwards compatibility this behavior is still supported by enabling the `allowExportsFolderMapping` (defaults to `true`).
|
201
|
+
The default value might change in a futur major release.
|
202
|
+
|
178
203
|
## Preserving symlinks
|
179
204
|
|
180
205
|
This plugin honours the rollup [`preserveSymlinks`](https://rollupjs.org/guide/en/#preservesymlinks) option.
|
@@ -234,6 +259,25 @@ this.resolve(importee, importer, {
|
|
234
259
|
});
|
235
260
|
```
|
236
261
|
|
262
|
+
## Resolve Options
|
263
|
+
|
264
|
+
After this plugin resolved an import id to its target file in `node_modules`, it will invoke `this.resolve` again with the resolved id. It will pass the following information in the resolve options:
|
265
|
+
|
266
|
+
```js
|
267
|
+
this.resolve(resolved.id, importer, {
|
268
|
+
custom: {
|
269
|
+
'node-resolve': {
|
270
|
+
resolved, // the object with information from node.js resolve
|
271
|
+
importee // the original import id
|
272
|
+
}
|
273
|
+
}
|
274
|
+
});
|
275
|
+
```
|
276
|
+
|
277
|
+
Your plugin can use the `importee` information to map an original import to its resolved file in `node_modules`, in a plugin hook such as `resolveId`.
|
278
|
+
|
279
|
+
The `resolved` object contains the resolved id, which is passed as the first parameter. It also has a property `moduleSideEffects`, which may contain the value from the npm `package.json` field `sideEffects` or `null`.
|
280
|
+
|
237
281
|
## Meta
|
238
282
|
|
239
283
|
[CONTRIBUTING](/.github/CONTRIBUTING.md)
|