Skip to content

Commit 4de8904

Browse files
rathbomanklayman
andauthored
feat(docs/guide): add instructions for yarn workspaces (#1414)
Co-authored-by: Noah Klayman <[email protected]>
1 parent da225e4 commit 4de8904

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/guide/guide.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,34 @@ Now, create a worker like so:
145145
```js
146146
new Worker('./worker.js', { type: 'module' })
147147
```
148+
## Using Yarn Workspaces
149+
150+
If you are using [Yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/) you need to set `nodeModulesPath` to include both the package node_modules, and the workspace node_modules.
151+
152+
You should also move your eslint config to the workspace root or you'll get lots of weird messages.
153+
154+
This is becuase yarn workspaces 'hoists' shared dependencies to the top level and this plugin needs to be able to scan your node_modules to check for native dependencies to externalize.
155+
156+
For example, with this directory structure:
157+
```
158+
package.json (in workspace root)
159+
packages/
160+
app/
161+
components/
162+
```
163+
Inside `packages/app/vue.config.js` add the following line to the plugin config:
164+
165+
```
166+
module.exports = {
167+
pluginOptions: {
168+
electronBuilder: {
169+
nodeModulesPath: ['./node_modules', '../../node_modules'],
170+
...
171+
}
172+
}
173+
}
174+
```
175+
148176

149177
## How it works
150178

0 commit comments

Comments
 (0)