{"name":"@pmmmwh/react-refresh-webpack-plugin","version":"0.3.0","keywords":["react","javascript","webpack","refresh","hmr","hotreload","livereload","live","edit","hot","reload"],"author":{"name":"Michael Mok"},"license":"MIT","_id":"@pmmmwh/react-refresh-webpack-plugin@0.3.0","maintainers":[{"name":"pmmmwh","email":"pmmmwh@gmail.com"}],"homepage":"https://github.com/pmmmwh/react-refresh-webpack-plugin#readme","bugs":{"url":"https://github.com/pmmmwh/react-refresh-webpack-plugin/issues"},"dist":{"shasum":"1caa675c3098801152537ee63420bcd672213295","tarball":"http://registry-npm.ywwl.com/@pmmmwh/react-refresh-webpack-plugin/download/@pmmmwh/react-refresh-webpack-plugin-0.3.0.tgz","fileCount":38,"integrity":"sha512-zeWx7HJ+7yJBFgm8TTEqUiUj172NcQxYduiAcK5ks9OHYdWgzfxfygtxlhvEzMLFM9fX60/dKxqFvlPKTGltOg==","signatures":[{"sig":"MEQCIE+msA+N9QyJ/74wwEGNrHQ+ZfUqsnaBvO9CoutnIt7gAiBvhekoIkqGI3znWnp3PwWup4J9haWnRnyUfBud9YRjtA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":81215,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJetvymCRA9TVsSAnZWagAAWxMP/A/E0XW9cy6ObvpGkses\nUvUdx4qV+kSJMPlfOyebkDu9btmvRPrDONHK2Jxk1QR9M2duNtGRAPnfBi1Y\nrCaSFCEgbW4JL8pZWmEPsb5i0HpgDy/+tQMRQz/gwA5dBWaigKRRIOswmI6h\nsdnd/NqEvAZ0DOumt7S3SagginFcvfZV88xfTAe5fYQyhSaFXjXrt31ErY4Q\nJVDFqWjhgv8tA9i0ALfj0xixSG8kXc6F6HMiGBzpXHEhJ/EWMuUwMAWAr2pK\nsyMZ1eh+ZQpiqiGR++mAVyiQjpCUtMxz7/MQQOB06UU6cvKiGAgFBwDDD/Fz\ntr3XBoe8nOnL7sMDX4lQppSMMzI2qyF17o0Qai14CRpZG4KVLodZRId8oKy3\nyG4+OJ4I1wWbweMEUL//3fg54wtgAy3CDbFKGXPzwZSdW8VoleAS9eY9p/r3\nwKZxx2H4nEd5/8pXAO2DuD6EQlnLfm+He3nfZaOamRA0Uz1BvrYHrU6jMgEI\ntSYpktr+EcuiIgmbh12wm+1BGiVrhZ1R9utkO1PtpFbaBymFdG0eGY7AGlLW\nIGqFWbist/92lbqWPtE7Aosrg64tFPZGObLqT8AIdXguZs3lqDMRCPFsnnUn\n+ZIhLD/nLYikpSqvLMj+oBiwYB1sADA5G75hC76XMDeU2Z2Ml0Ercnt4hm1t\nFVKH\r\n=ZoFo\r\n-----END PGP SIGNATURE-----\r\n","size":23362,"noattachment":false,"key":"/@pmmmwh/react-refresh-webpack-plugin/-/@pmmmwh/react-refresh-webpack-plugin-0.3.0.tgz"},"main":"src/index.js","types":"types/index.d.ts","engines":{"node":">= 8.x"},"gitHead":"0dc6e91943d7915b8f2d78e9e117260b759a68fa","scripts":{"lint":"eslint --report-unused-disable-directives --ext .js .","format":"prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"","lint:fix":"yarn lint --fix","format:check":"prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\"","generate-types":"tsc -p tsconfig.json && rimraf \"types/{helpers,runtime}\" && yarn format","prepublishOnly":"rimraf types && yarn generate-types"},"_npmUser":{"name":"pmmmwh","email":"pmmmwh@gmail.com"},"repository":{"url":"git+https://github.com/pmmmwh/react-refresh-webpack-plugin.git","type":"git"},"_npmVersion":"6.13.4","description":"An **EXPERIMENTAL** Webpack plugin to enable \"Fast Refresh\" (also previously known as _Hot Reloading_) for React components.","directories":{},"_nodeVersion":"12.14.0","dependencies":{"ansi-html":"^0.0.7","native-url":"^0.2.6","schema-utils":"^2.6.5","html-entities":"^1.2.1","lodash.debounce":"^4.0.8","error-stack-parser":"^2.0.6"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^6.8.0","rimraf":"^3.0.2","webpack":"^4.42.1","prettier":"^2.0.4","type-fest":"^0.13.1","typescript":"^3.8.3","@types/node":"^13.11.1","react-refresh":"^0.8.1","@types/webpack":"^4.41.11","@types/json-schema":"^7.0.4","webpack-plugin-serve":"^0.12.1","eslint-config-prettier":"^6.10.1","webpack-hot-middleware":"^2.25.0"},"peerDependencies":{"type-fest":"^0.13.1","react-refresh":"^0.8.1","sockjs-client":"^1.4.0","@types/webpack":"^4.41.11","webpack-plugin-serve":"^0.12.1","webpack-hot-middleware":"^2.25.0"},"peerDependenciesMeta":{"type-fest":{"optional":true},"sockjs-client":{"optional":true},"@types/webpack":{"optional":true},"webpack-plugin-serve":{"optional":true},"webpack-hot-middleware":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/react-refresh-webpack-plugin_0.3.0_1589050534482_0.3254961549561983","host":"s3://npm-registry-packages"},"readme":"# React Refresh Webpack Plugin\n\n[actions]: https://github.com/pmmmwh/react-refresh-webpack-plugin/actions/workflows/ci.yml\n[actions:badge]: https://img.shields.io/github/actions/workflow/status/pmmmwh/react-refresh-webpack-plugin/ci.yml?branch=main\n[license:badge]: https://img.shields.io/github/license/pmmmwh/react-refresh-webpack-plugin\n[npm:latest]: https://www.npmjs.com/package/@pmmmwh/react-refresh-webpack-plugin/v/latest\n[npm:latest:badge]: https://img.shields.io/npm/v/@pmmmwh/react-refresh-webpack-plugin/latest\n[npm:next]: https://www.npmjs.com/package/@pmmmwh/react-refresh-webpack-plugin/v/next\n[npm:next:badge]: https://img.shields.io/npm/v/@pmmmwh/react-refresh-webpack-plugin/next\n\n[![GitHub Actions][actions:badge]][actions]\n[![License][license:badge]](./LICENSE)\n[![Latest Version][npm:latest:badge]][npm:latest]\n[![Next Version][npm:next:badge]][npm:next]\n\nA Webpack plugin to enable \"Fast Refresh\" (also known as _Hot Reloading_) for React components.\n\n> We're hoping to land a v1 release soon - please help us by reporting any issues you've encountered!\n\n## Getting Started\n\n### Prerequisites\n\nEnsure that you are using at least the minimum supported versions of this plugin's peer dependencies -\nolder versions unfortunately do not contain code to orchestrate \"Fast Refresh\",\nand thus cannot be made compatible.\n\nWe recommend using the following versions:\n\n| Dependency      | Version                              |\n| --------------- | ------------------------------------ |\n| `Node.js`       | `18.12.0`+, `20.x`, `22.x`           |\n| `react`         | `16.13.0`+, `17.x`, `18.x` or `19.x` |\n| `react-dom`     | `16.13.0`+, `17.x`, `18.x` or `19.x` |\n| `react-refresh` | `0.10.0`+                            |\n| `webpack`       | `5.2.0`+                             |\n\n<details>\n<summary>Minimum requirements</summary>\n<br />\n\n| Dependency      | Version   |\n| --------------- | --------- |\n| `Node.js`       | `18.12.0` |\n| `react`         | `16.9.0`  |\n| `react-dom`     | `16.9.0`  |\n| `react-refresh` | `0.10.0`  |\n| `webpack`       | `5.2.0`   |\n\n</details>\n\n<details>\n<summary>Using custom renderers (e.g. <code>react-three-fiber</code>, <code>react-pdf</code>, <code>ink</code>)</summary>\n<br />\n\nTo ensure full support of \"Fast Refresh\" with components rendered by custom renderers,\nyou should ensure the renderer you're using depends on a recent version of `react-reconciler`.\n\nWe recommend version `0.25.0` or above, but any versions above `0.22.0` should work.\n\nIf the renderer is not compatible, please file them an issue instead.\n\n</details>\n\n### Installation\n\nWith all prerequisites met, you can install this plugin using your package manager of choice:\n\n```sh\n# if you prefer npm\nnpm install -D @pmmmwh/react-refresh-webpack-plugin react-refresh\n\n# if you prefer yarn\nyarn add -D @pmmmwh/react-refresh-webpack-plugin react-refresh\n\n# if you prefer pnpm\npnpm add -D @pmmmwh/react-refresh-webpack-plugin react-refresh\n```\n\nThe `react-refresh` package (from the React team) is a required peer dependency of this plugin.\nWe recommend using version `0.10.0` or above.\n\n<details>\n<summary>Support for TypeScript</summary>\n<br />\n\nTypeScript support is available out-of-the-box for those who use `webpack.config.ts`.\n\nOur exported types however depends on `type-fest`, so you'll have to add it as a `devDependency`:\n\n```sh\n# if you prefer npm\nnpm install -D type-fest\n\n# if you prefer yarn\nyarn add -D type-fest\n\n# if you prefer pnpm\npnpm add -D type-fest\n```\n\n> **:memo: Note**:\n>\n> `type-fest@4.x` only supports Node.js v16 or above,\n> `type-fest@3.x` only supports Node.js v14.16 or above,\n> and `type-fest@2.x` only supports Node.js v12.20 or above.\n> If you're using an older version of Node.js, please install `type-fest@1.x`.\n\n</details>\n\n### Usage\n\nFor most setups, we recommend integrating with `babel-loader`.\nIt covers the most use cases and is officially supported by the React team.\n\nThe example below will assume you're using `webpack-dev-server`.\n\nIf you haven't done so, set up your development Webpack configuration for Hot Module Replacement (HMR).\n\n```js\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nmodule.exports = {\n  mode: isDevelopment ? 'development' : 'production',\n  devServer: {\n    hot: true,\n  },\n};\n```\n\n<details>\n<summary>Using <code>webpack-hot-middleware</code></summary>\n<br />\n\n```js\nconst webpack = require('webpack');\n\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nmodule.exports = {\n  mode: isDevelopment ? 'development' : 'production',\n  plugins: [isDevelopment && new webpack.HotModuleReplacementPlugin()].filter(Boolean),\n};\n```\n\n</details>\n\n<details>\n<summary>Using <code>webpack-plugin-serve</code></summary>\n<br />\n\n```js\nconst { WebpackPluginServe } = require('webpack-plugin-serve');\n\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nmodule.exports = {\n  mode: isDevelopment ? 'development' : 'production',\n  plugins: [isDevelopment && new WebpackPluginServe()].filter(Boolean),\n};\n```\n\n</details>\n\nThen, add the `react-refresh/babel` plugin to your Babel configuration and this plugin to your Webpack configuration.\n\n```js\nconst ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');\n\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nmodule.exports = {\n  mode: isDevelopment ? 'development' : 'production',\n  module: {\n    rules: [\n      {\n        test: /\\.[jt]sx?$/,\n        exclude: /node_modules/,\n        use: [\n          {\n            loader: require.resolve('babel-loader'),\n            options: {\n              plugins: [isDevelopment && require.resolve('react-refresh/babel')].filter(Boolean),\n            },\n          },\n        ],\n      },\n    ],\n  },\n  plugins: [isDevelopment && new ReactRefreshWebpackPlugin()].filter(Boolean),\n};\n```\n\n> **:memo: Note**:\n>\n> Ensure both the Babel transform (`react-refresh/babel`) and this plugin are enabled only in `development` mode!\n\n<details>\n<summary>Using <code>ts-loader</code></summary>\n<br />\n\n> **:warning: Warning**:\n> This is an un-official integration maintained by the community.\n\nInstall [`react-refresh-typescript`](https://github.com/Jack-Works/react-refresh-transformer/tree/main/typescript).\nEnsure your TypeScript version is at least 4.0.\n\n```sh\n# if you prefer npm\nnpm install -D react-refresh-typescript\n\n# if you prefer yarn\nyarn add -D react-refresh-typescript\n\n# if you prefer pnpm\npnpm add -D react-refresh-typescript\n```\n\nThen, instead of wiring up `react-refresh/babel` via `babel-loader`,\nyou can wire-up `react-refresh-typescript` with `ts-loader`:\n\n```js\nconst ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');\nconst ReactRefreshTypeScript = require('react-refresh-typescript');\n\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nmodule.exports = {\n  mode: isDevelopment ? 'development' : 'production',\n  module: {\n    rules: [\n      {\n        test: /\\.[jt]sx?$/,\n        exclude: /node_modules/,\n        use: [\n          {\n            loader: require.resolve('ts-loader'),\n            options: {\n              getCustomTransformers: () => ({\n                before: [isDevelopment && ReactRefreshTypeScript()].filter(Boolean),\n              }),\n              transpileOnly: isDevelopment,\n            },\n          },\n        ],\n      },\n    ],\n  },\n  plugins: [isDevelopment && new ReactRefreshWebpackPlugin()].filter(Boolean),\n};\n```\n\n> It is recommended to run `ts-loader` with `transpileOnly` is set to `true`.\n> You can use `ForkTsCheckerWebpackPlugin` as an alternative if you need typechecking during development.\n\n</details>\n\n<details>\n<summary>Using <code>swc-loader</code></summary>\n<br />\n\n> **:warning: Warning**:\n> This is an un-official integration maintained by the community.\n\nEnsure your `@swc/core` version is at least `1.2.86`.\nIt is also recommended to use `swc-loader` version `0.1.13` or above.\n\nThen, instead of wiring up `react-refresh/babel` via `babel-loader`,\nyou can wire-up `swc-loader` and use the `refresh` transform:\n\n```js\nconst ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');\n\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nmodule.exports = {\n  mode: isDevelopment ? 'development' : 'production',\n  module: {\n    rules: [\n      {\n        test: /\\.[jt]sx?$/,\n        exclude: /node_modules/,\n        use: [\n          {\n            loader: require.resolve('swc-loader'),\n            options: {\n              jsc: {\n                transform: {\n                  react: {\n                    development: isDevelopment,\n                    refresh: isDevelopment,\n                  },\n                },\n              },\n            },\n          },\n        ],\n      },\n    ],\n  },\n  plugins: [isDevelopment && new ReactRefreshWebpackPlugin()].filter(Boolean),\n};\n```\n\n> Starting from version `0.1.13`, `swc-loader` will set the `development` option based on Webpack's `mode` option.\n> `swc` won't enable fast refresh when `development` is `false`.\n\n</details>\n\nFor more information on how to set up \"Fast Refresh\" with different integrations,\nplease check out [our examples](examples).\n\n### Overlay Integration\n\nThis plugin integrates with the most common Webpack HMR solutions to surface errors during development -\nin the form of an error overlay.\n\nBy default, `webpack-dev-server` is used,\nbut you can set the [`overlay.sockIntegration`](docs/API.md#sockintegration) option to match what you're using.\n\nThe supported versions are as follows:\n\n| Dependency               | Version                    |\n| ------------------------ | -------------------------- |\n| `webpack-dev-server`     | `4.8.0`+ or `5.x` or `6.x` |\n| `webpack-hot-middleware` | `2.x`                      |\n| `webpack-plugin-serve`   | `1.x`                      |\n\n## API\n\nPlease refer to [the API docs](docs/API.md) for all available options.\n\n## FAQs and Troubleshooting\n\nPlease refer to [the Troubleshooting guide](docs/TROUBLESHOOTING.md) for FAQs and resolutions to common issues.\n\n## License\n\nThis project is licensed under the terms of the [MIT License](/LICENSE).\n\n## Special Thanks\n\n<a href=\"https://jb.gg/OpenSource?from=ReactRefreshWebpackPlugin\" target=\"_blank\">\n  <img\n    alt=\"JetBrains Logo\"\n    src=\"https://user-images.githubusercontent.com/9338255/132110580-61d3dba5-f5c7-4479-bd8e-39cd65b42fc5.png\"\n    width=\"120\"\n  />\n</a>\n","publish_time":1589050534586,"_cnpm_publish_time":1589050534586,"dist-tags":{"latest":"0.6.3","next":"0.6.3"}}