{"name":"@pmmmwh/react-refresh-webpack-plugin","version":"0.5.0-rc.2","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.5.0-rc.2","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":"7f1049150d8474cd8bfe21ae0efec581238dc924","tarball":"http://registry-npm.ywwl.com/@pmmmwh/react-refresh-webpack-plugin/download/@pmmmwh/react-refresh-webpack-plugin-0.5.0-rc.2.tgz","fileCount":56,"integrity":"sha512-LTZK5rAAiog7FvsDKX7mJBifV9yyzhIXHqlHA8E978Z0iFLsW40j6OVJFZ/AzV3wBIvN3+iPVYvhVGckkoy8OQ==","signatures":[{"sig":"MEUCIE4gtdBmFhVcqNI688UK4wTrSbt0hoWSZlDlLf755AdvAiEAu5zBrEjf4ynvVTTw9q0ABYD7TJzNL6ZodScnwR8USkU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":122856,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg7NqFCRA9TVsSAnZWagAAOgAQAJMUtyj+586cmtCM99aJ\n2w8FDRQU+zIyxaZJ6xd9gRLWjXZ9W4lBfGpnHVqydNo2fxY/wyLM69MCOJxj\nfGqTZAerL14uVCb+g8IBq4dSOW8L5In0ubCv5ycEvLn6ybrtRYweH1Ufp4NJ\nTMcUHu6M6OMYnXZfGzUHso2LkjVNQCJ/3rAFLume6Jt4fKKAdhSdGO47fcXE\nBMzARxOASjtJghw+LgCw4GmhTVqCop9EwleIO2P89SbM/WSJrdNVENQW+UBL\n6q+K3qt4+JxzLtBuV6WgJjioFDOij7C5PRWFX2hEtZGzxnoKccd8FErXbS3k\nPPal8EX9NAJiBq5decRcXSY5PMNU00iClEcjTYKRs9AQ4C7etGmVxM7gDshW\nrNhg8B31pw8uUEobHn+QXB9KzyZnI/5Bsd8Vs46LQxod/2IbrWm5iKektCh9\npjoIvCK8/ao6XDwAsEsYy9goqzgZF+RMRXXFjbatPqyb5g4ApQypA2KZBig/\nw0pS2FbgTgFDi9flMXQs6ixPq/DcYTV1NFzLzvHsdvG974q8fnyLYgZlB4iS\nMXT71jgOArJhQiiY3R/n8+RHy9SBbjziCZsC61u8LuDYccnV7yUEdTYzOhGq\nnCdtIKO7qRUim+aCPCO+nBrgEA3WVnEZANqyMlJsR9SdL2c40oMIJ8rJSXuM\nyMuK\r\n=TjbP\r\n-----END PGP SIGNATURE-----\r\n","size":34133,"noattachment":false,"key":"/@pmmmwh/react-refresh-webpack-plugin/-/@pmmmwh/react-refresh-webpack-plugin-0.5.0-rc.2.tgz"},"main":"lib/index.js","types":"types/lib/index.d.ts","readme":"# React Refresh Webpack Plugin\n\n[![Latest Version](https://img.shields.io/npm/v/@pmmmwh/react-refresh-webpack-plugin/latest)](https://www.npmjs.com/package/@pmmmwh/react-refresh-webpack-plugin/v/latest)\n[![Next Version](https://img.shields.io/npm/v/@pmmmwh/react-refresh-webpack-plugin/next)](https://www.npmjs.com/package/@pmmmwh/react-refresh-webpack-plugin/v/next)\n[![CircleCI](https://img.shields.io/circleci/project/github/pmmmwh/react-refresh-webpack-plugin/main)](https://app.circleci.com/pipelines/github/pmmmwh/react-refresh-webpack-plugin)\n[![License](https://img.shields.io/github/license/pmmmwh/react-refresh-webpack-plugin)](./LICENSE)\n\nAn **EXPERIMENTAL** Webpack plugin to enable \"Fast Refresh\" (also previously known as _Hot Reloading_) for React components.\n\n## Prerequisites\n\nFirst and foremost, this plugin is not 100% stable.\nWe're working towards a stable v1 release, and we've been testing the plugin quite extensively;\nbut since it is still pretty young, there might still be some unknown edge cases.\n\nThere are no breaking changes planned for the v1 release,\nbut they might still happen if we hit some significant road blockers.\n\nAlso, ensure that you are using the minimum supported versions of the plugin's peer dependencies -\nolder versions unfortunately do not contain code to orchestrate \"Fast Refresh\",\nand thus cannot be made compatible.\n\n| Dependency         | Minimum                                            | Best       |\n| ------------------ | -------------------------------------------------- | ---------- |\n| `react`            | `16.9.0`                                           | `16.13.0`+ |\n| `react-dom`        | `16.9.0`                                           | `16.13.0`+ |\n| `react-reconciler` | `0.22.0`                                           | `0.25.0`+  |\n| `webpack`          | `4.0.0` (for `0.3.x`)<br />`4.43.0` (for `0.4.x`+) | `4.43.0`+  |\n\n> You only need `react-dom` if you're rendering to the DOM.\n\n> You only need to check for `react-reconciler` if you use custom reconcilers like `react-three-fiber`.\n> You should check their `package.json` to make sure they use a compatible version instead of installing `react-reconciler` yourself.\n> If the reconcilers are not compatible, please create an issue at their repository.\n\n## Installation\n\nWith all prerequisites met, you can install the plugin with one of the commands below:\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 plugin depends on a package from the React team - `react-refresh`,\nso you will have to install and configure it separately as demonstrated in the [Usage](#usage) section.\n\n### TypeScript\n\nTypeScript support is available out-of-the-box for those who use `webpack.config.ts` :tada:!\n\nFor that you will have to install `type-fest` as a development peer dependency with one of the commands below:\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## Usage\n\nThe most basic setup to enable \"Fast Refresh\" is to update your `webpack.config.js` (or `.ts`) as follows:\n\n### With babel-loader\n\n```js\nconst ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');\nconst webpack = require('webpack');\n// ... your other imports\n\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nmodule.exports = {\n  // It is suggested to run both `react-refresh/babel` and the plugin in the `development` mode only,\n  // even though both of them have optimisations in place to do nothing in the `production` mode.\n  // If you would like to override Webpack's defaults for modes, you can also use the `none` mode -\n  // you then will need to set `forceEnable: true` in the plugin's options.\n  mode: isDevelopment ? 'development' : 'production',\n  module: {\n    rules: [\n      // ... other rules\n      {\n        test: /\\.[jt]sx?$/,\n        exclude: /node_modules/,\n        use: [\n          // ... other loaders\n          {\n            loader: require.resolve('babel-loader'),\n            options: {\n              // ... other options\n              plugins: [\n                // ... other plugins\n                isDevelopment && require.resolve('react-refresh/babel'),\n              ].filter(Boolean),\n            },\n          },\n        ],\n      },\n    ],\n  },\n  plugins: [\n    // ... other plugins\n    isDevelopment && new webpack.HotModuleReplacementPlugin(),\n    isDevelopment && new ReactRefreshWebpackPlugin(),\n  ].filter(Boolean),\n  // ... other configuration options\n};\n```\n\n### With ts-loader\n\nYou need to install [react-refresh-typescript](https://github.com/Jack-Works/react-refresh-transformer/tree/main/typescript) and your TypeScript must be at least 4.0.\n\nEmit module must be `ESModule` not `CommonJS`. You can overwrite it in `ts-loader` and still use `CommonJS` in your tsconfig file.\n\n> ⚠ This package is maintained by the community not by Facebook.\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\n```js\nconst ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');\nconst webpack = require('webpack');\nconst ReactRefreshTypeScript = require('react-refresh-typescript');\n// ... your other imports\n\nconst isDevelopment = process.env.NODE_ENV !== 'production';\n\nmodule.exports = {\n  // It is suggested to run both `react-refresh-typescript` and the plugin in the `development` mode only,\n  // even though both of them have optimisations in place to do nothing in the `production` mode.\n  // If you would like to override Webpack's defaults for modes, you can also use the `none` mode -\n  // you then will need to set `forceEnable: true` in the plugin's options.\n  mode: isDevelopment ? 'development' : 'production',\n  module: {\n    rules: [\n      // ... other rules\n      {\n        test: /\\.[jt]sx?$/,\n        exclude: /node_modules/,\n        use: [\n          // ... other loaders\n          {\n            loader: require.resolve('ts-loader'),\n            options: {\n              getCustomTransformers: () => ({\n                before: isDevelopment ? [ReactRefreshTypeScript()] : [],\n              }),\n            },\n          },\n        ],\n      },\n    ],\n  },\n  plugins: [\n    // ... other plugins\n    isDevelopment && new webpack.HotModuleReplacementPlugin(),\n    isDevelopment && new ReactRefreshWebpackPlugin(),\n  ].filter(Boolean),\n  // ... other configuration options\n};\n```\n\nYou might want to further tweak the configuration to accommodate your setup:\n\n- `isDevelopment`\n\n  In this example we've shown the simple way of splitting up `development` and `production` builds with the `NODE_ENV` environment variable.\n  It will default to `true` (i.e. `development` mode) when `NODE_ENV` is not available from the environment.\n\n  In practice though, you might want to wire this up differently,\n  like [using a function config](https://webpack.js.org/configuration/configuration-types/#exporting-a-function) or using multiple configuration files.\n\n- `webpack.HotModuleReplacementPlugin`\n\n  If you use `webpack-dev-server` or `webpack-plugin-serve`,\n  you can set `devServer.hot`/`devServer.hotOnly` and `hmr` to `true` respectively,\n  instead of adding the HMR plugin to your plugin list.\n\n### Integration Support for Overlay\n\nOfficially, `webpack-dev-server`, `webpack-hot-middleware` and `webpack-plugin-serve` are supported out of the box -\nyou just have to set the [`overlay.sockIntegration`](docs/API.md#sockintegration) option to match what you're using.\n\nFor each of the integrations listed above,\nyou can also take a look at the corresponding [sample projects](https://github.com/pmmmwh/react-refresh-webpack-plugin/tree/main/examples) for a better understanding of how things should be wired up.\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## Related Work\n\n- [Initial Implementation by @maisano](https://gist.github.com/maisano/441a4bc6b2954205803d68deac04a716)\n","engines":{"node":">= 10.13"},"gitHead":"52cd3a7f2e594fce187d3f1e0c32d201da798376","scripts":{"lint":"eslint --report-unused-disable-directives --ext .js .","test":"node scripts/test.js","format":"prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"","pretest":"yarn link && yarn link \"@pmmmwh/react-refresh-webpack-plugin\"","lint:fix":"yarn lint --fix","posttest":"yarn unlink \"@pmmmwh/react-refresh-webpack-plugin\"","format:check":"prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\"","generate-types":"tsc -p tsconfig.json && yarn prune-private-types && yarn format --loglevel silent","prepublishOnly":"rimraf types && yarn generate-types","test:webpack-4":"cross-env WEBPACK_VERSION=4 yarn test","prune-private-types":"del \"types/*/*\" \"!types/{lib,loader,options}/{index,types}.d.ts\""},"_npmUser":{"name":"pmmmwh","email":"pmmmwh@gmail.com"},"repository":{"url":"git+https://github.com/pmmmwh/react-refresh-webpack-plugin.git","type":"git"},"_npmVersion":"7.15.0","description":"An **EXPERIMENTAL** Webpack plugin to enable \"Fast Refresh\" (also previously known as _Hot Reloading_) for React components.","directories":{},"resolutions":{"type-fest":"^1.2.1"},"_nodeVersion":"15.12.0","dependencies":{"ansi-html":"^0.0.7","source-map":"^0.7.3","core-js-pure":"^3.8.1","loader-utils":"^2.0.0","schema-utils":"^3.0.0","html-entities":"^2.1.0","error-stack-parser":"^2.0.6"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"yn":"^4.0.0","jest":"^27.0.5","memfs":"^3.2.0","eslint":"^7.26.0","nanoid":"^3.1.23","del-cli":"^3.0.1","webpack":"^5.42.0","fs-extra":"^9.0.1","get-port":"^5.1.1","prettier":"^2.3.0","cross-env":"^7.0.3","puppeteer":"^9.1.1","type-fest":"^1.2.1","babel-jest":"^27.0.5","jest-junit":"^12.2.0","typescript":"4.3.5","@babel/core":"^7.14.2","@types/jest":"^26.0.23","@types/node":"^16.0.0","cross-spawn":"^7.0.3","jest-circus":"^27.0.5","webpack-cli":"^4.7.2","babel-loader":"^8.1.0","module-alias":"^2.2.2","react-refresh":"^0.10.0","@types/webpack":"^5.28.0","webpack.legacy":"npm:webpack@4.x","@types/fs-extra":"^9.0.4","@types/puppeteer":"^5.4.0","@types/cross-spawn":"^6.0.2","@types/json-schema":"^7.0.6","webpack-cli.legacy":"npm:webpack-cli@3.x","webpack-dev-server":"^3.11.2","@types/module-alias":"^2.0.0","sourcemap-validator":"^2.1.0","jest-watch-typeahead":"^0.6.4","webpack-plugin-serve":"^1.4.1","jest-environment-node":"^27.0.5","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","webpack-hot-middleware":"^2.25.0","@babel/plugin-transform-modules-commonjs":"^7.14.0"},"peerDependencies":{"webpack":">=4.43.0 <6.0.0","type-fest":"1.x","react-refresh":"^0.10.0","sockjs-client":"^1.4.0","@types/webpack":"4.x || 5.x","webpack-dev-server":"3.x || >=4.0.0-beta.0","webpack-plugin-serve":"0.x || 1.x","webpack-hot-middleware":"2.x"},"peerDependenciesMeta":{"type-fest":{"optional":true},"sockjs-client":{"optional":true},"@types/webpack":{"optional":true},"webpack-dev-server":{"optional":true},"webpack-plugin-serve":{"optional":true},"webpack-hot-middleware":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/react-refresh-webpack-plugin_0.5.0-rc.2_1626135172869_0.8309262382152085","host":"s3://npm-registry-packages"},"publish_time":1626135173210,"_cnpm_publish_time":1626135173210,"dist-tags":{"latest":"0.6.3","next":"0.6.3"}}