Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubleshooting steps to make HMR work in complex webpack configs #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,22 @@ Granular mode for HMR (which allows independent HMR for components and templates
### JSX HMR

JSX, by default, is moved to a separate component to perform granular HMR. To disable this, add `jsx: false`.

## Troubleshooting

### Webpack and dynamic exports

If HMR doesn't work for you in webpack, and you see this warning in the browser's console:

> 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.

Consider checking `resolve.mainFields` and `resolve.conditionNames`. If you only want to use SolidJS then you could safely remove them.

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.

```js
resolve: {
mainFields: ['something-else', 'browser', '...'],
conditionNames: ['something-else', 'browser', '...'],
} // ^^^ this includes default configuration
```