Skip to content

Commit

Permalink
Merge pull request #61 from pmmmwh/fix/missing-node-url
Browse files Browse the repository at this point in the history
fix: use native-url instead of node's url for compat
  • Loading branch information
pmmmwh authored Apr 1, 2020
2 parents e614f2f + 8cbd4c7 commit 1cbe846
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
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

0 comments on commit 1cbe846

Please sign in to comment.