Skip to content

Commit 937de6e

Browse files
committed
Troubleshooting steps to make HMR work in complex webpack configs
1 parent ad30cba commit 937de6e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,22 @@ Granular mode for HMR (which allows independent HMR for components and templates
226226
### JSX HMR
227227

228228
JSX, by default, is moved to a separate component to perform granular HMR. To disable this, add `jsx: false`.
229+
230+
## Troubleshooting
231+
232+
### Webpack and dynamic exports
233+
234+
If HMR doesn't work for you in webpack, and you see this warning in the browser's console:
235+
236+
> To use solid-refresh, you need to use the dev build of SolidJS. Make sure your build system supports package.json conditional exports and has the 'development' condition turned on.
237+
238+
Consider checking `resolve.mainFields` and `resolve.conditionNames`. If you only want to use SolidJS then you could safely remove them.
239+
240+
Otherwise, append '...' to each array to also include webpack's default configuration, that is required for conditional exports and development condition to work properly. E.g.
241+
242+
```js
243+
resolve: {
244+
mainFields: ['something-else', 'browser', '...'],
245+
conditionNames: ['something-else', 'browser', '...'],
246+
} // ^^^ this includes default configuration
247+
```

0 commit comments

Comments
 (0)