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

fix: use native-url instead of node's url for compat #61

Merged
merged 2 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
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
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,31 @@ More sample projects for common Webpack development setups are available in the
> Note: If you are using TypeScript (instead of Babel) as a transpiler, you will still need to use `babel-loader` to process your source code.
> Check out this [sample project](https://github.com/pmmmwh/react-refresh-webpack-plugin/tree/master/examples/typescript-without-babel) on how to set this up.

### Polyfill for Older Browsers (WDS Only)

If you need to develop on IE11, you will need to polyfill the DOM URL API.
This can be done by adding the following before any of your code in the main entry (either one is fine):

**Using `url-polyfill`**

```js
import 'url-polyfill';
```

**Using `core-js`**

```js
import 'core-js/features/url';
import 'core-js/features/url-search-params';
```

**Using `react-app-polyfill`**

```js
import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
```

## Options

This plugin accepts a few options that are specifically targeted for advanced users.
Expand Down Expand Up @@ -161,7 +186,6 @@ Modifies how the error overlay integration works in the plugin.
};
```


### `options.sockHost`

Type: `string`
Expand All @@ -174,7 +198,7 @@ Set this if you are running webpack on a host other than `window.location.hostna
Type: `number`
Default: effectively `window.location.port`

Set this if you are running webpack on a port other than `window.location.port`
Set this if you are running webpack on a port other than `window.location.port`

### `options.sockPath`

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"ansi-html": "^0.0.7",
"error-stack-parser": "^2.0.6",
"html-entities": "^1.2.1",
"lodash.debounce": "^4.0.8"
"lodash.debounce": "^4.0.8",
"native-url": "^0.2.6"
},
"devDependencies": {
"eslint": "^6.8.0",
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/createSocket.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line no-unused-vars
/* global __resourceQuery, __webpack_dev_server_client__ */

const url = require('url');
const url = require('native-url');
const loadWHMEventSource = require('./WHMEventSource');

/**
Expand Down