Skip to content

Commit 1526ed7

Browse files
committed
Typos
1 parent 082f24f commit 1526ed7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ How to handle the `node:` scheme used in recent versions of Node (i.e., `import
115115
> _Note that scheme handling is always applied, regardless of the `builtins` options being enabled or not._
116116
117117
#### packagePath?: string | string[] = []
118-
If you're working with monorepos, the `packagePath` option is made for you. It can take a path, or an array of paths, to your package.json file(s). If not specified, the default is to start with the current directory's package.json then go up scan for all `package.json` files in parent directories recursively until either the root git directory is reached or until no other `package.json` can be found.
118+
If you're working with monorepos, the `packagePath` option is made for you. It can take a path, or an array of paths, to your package.json file(s). If not specified, the default is to start with the current directory's package.json then go up scan for all `package.json` files in parent directories recursively until either the root git directory is reached, the root of the monorepo is reached, or no other `package.json` can be found.
119119

120120
#### deps?: boolean = true<br>devDeps?: boolean = false<br>peerDeps?: boolean = true<br>optDeps?: boolean = true
121121
Set the `deps`, `devDeps`, `peerDeps` and `optDeps` options to `false` to prevent the corresponding dependencies from being externalized, therefore letting Rollup bundle them with your code.
@@ -151,7 +151,7 @@ nodeExternals({
151151
It uses an exact match against your imports _as written in your code_. No resolving of path aliases or substitutions is made:
152152

153153
```js
154-
// In your code, say '@/lib' is an alias for node_modules/deep/path/to/some/lib:
154+
// In your code, say '@/lib' is an alias for source/deep/path/to/some/lib:
155155
import something from '@/lib'
156156
```
157157

@@ -160,7 +160,7 @@ If you don't want `lib` bundled in, then write:
160160
```js
161161
// In rollup.config.js:
162162
nodeExternals({
163-
include: '@/mylib'
163+
include: '@/lib'
164164
})
165165
```
166166

@@ -180,13 +180,13 @@ export default {
180180
}
181181
```
182182

183-
As a general rule of thumb, you will want to always make this plugin the first one in the `plugins` array.
183+
Note that as of version 7, this plugin's `resolveId` hook has a `order: 'pre'` property that will make Rollup call it very early in the module resolution process. Nevertheless, it is best to always make this plugin the first one in the `plugins` array.
184184

185185
### 4/ Rollup rules
186186
Rollup's own `external` configuration option always takes precedence over this plugin. This is intentional.
187187

188188
### 5/ Using with Vite
189-
While this plugin has always been compatible with Vite, it was previously necessary to use the following `vite.config.js` to make it work reliably in every situations:
189+
While this plugin has always been compatible with Vite, it was previously necessary to use the following `vite.config.js` to make it work reliably in every situation:
190190

191191
```js
192192
import { defineConfig } from 'vite'

source/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ interface PackageJson {
9090
// Get our own name and version
9191
const { name, version } = createRequire(import.meta.url)('../package.json') as PackageJson
9292

93-
// Files that mark the root of a workspace
93+
// Files that mark the root of a monorepo
9494
const workspaceRootFiles = new Set([
9595
'pnpm-workspace.yaml', // pnpm
9696
'lerna.json', // Lerna
@@ -125,8 +125,8 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
125125

126126
const config: Config = { ...defaults, ...options }
127127

128-
let include: RegExp[] = [], // Initialized to empty arrays
129-
exclude: RegExp[] = [] // as a workaround to https://github.com/Septh/rollup-plugin-node-externals/issues/30
128+
let include: RegExp[] = [], // Initialized to empty arrays as a workaround
129+
exclude: RegExp[] = [] // to https://github.com/Septh/rollup-plugin-node-externals/issues/30
130130

131131
const isIncluded = (id: string) => include.length > 0 && include.some(rx => rx.test(id)),
132132
isExcluded = (id: string) => exclude.length > 0 && exclude.some(rx => rx.test(id))
@@ -157,9 +157,9 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
157157
// from cwd up to the root of the git repo, the root of the monorepo,
158158
// or the root of the volume, whichever comes first.
159159
const packagePaths = ([] as string[])
160-
.concat(config.packagePath)
161-
.filter(isString)
162-
.map(packagePath => path.resolve(packagePath))
160+
.concat(config.packagePath)
161+
.filter(isString)
162+
.map(packagePath => path.resolve(packagePath))
163163
if (packagePaths.length === 0) {
164164
for (
165165
let current = process.cwd(), previous: string | undefined = undefined;

0 commit comments

Comments
 (0)