@rspack/plugin-react-refresh 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { Compiler } from '@rspack/core';
2
2
  import type { NormalizedPluginOptions, PluginOptions } from './options';
3
3
  export type { PluginOptions };
4
- export declare const loader = "builtin:react-refresh-loader";
5
4
  declare class ReactRefreshRspackPlugin {
6
5
  options: NormalizedPluginOptions;
7
6
  static deprecated_runtimePaths: string[];
7
+ static loader: string;
8
8
  constructor(options?: PluginOptions);
9
9
  apply(compiler: Compiler): void;
10
10
  }
package/dist/index.js CHANGED
@@ -2,14 +2,12 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- exports.loader = void 0;
6
5
  const node_path_1 = __importDefault(require("node:path"));
7
6
  const options_1 = require("./options");
8
7
  const paths_1 = require("./paths");
9
8
  const getAdditionalEntries_1 = require("./utils/getAdditionalEntries");
10
9
  const getSocketIntegration_1 = require("./utils/getSocketIntegration");
11
10
  const getIntegrationEntry_1 = require("./utils/getIntegrationEntry");
12
- exports.loader = 'builtin:react-refresh-loader';
13
11
  function addEntry(entry, compiler) {
14
12
  new compiler.webpack.EntryPlugin(compiler.context, entry, {
15
13
  name: undefined,
@@ -40,8 +38,10 @@ class ReactRefreshRspackPlugin {
40
38
  devServer: compiler.options.devServer,
41
39
  options: this.options,
42
40
  });
43
- for (const entry of addEntries.prependEntries) {
44
- addEntry(entry, compiler);
41
+ if (this.options.injectEntry) {
42
+ for (const entry of addEntries.prependEntries) {
43
+ addEntry(entry, compiler);
44
+ }
45
45
  }
46
46
  if (this.options.overlay !== false &&
47
47
  this.options.overlay.sockIntegration) {
@@ -61,7 +61,7 @@ class ReactRefreshRspackPlugin {
61
61
  // biome-ignore lint: exists
62
62
  or: [this.options.exclude, [...paths_1.runtimePaths]].filter(Boolean),
63
63
  },
64
- use: exports.loader,
64
+ use: ReactRefreshRspackPlugin.loader,
65
65
  });
66
66
  }
67
67
  const definedModules = {
@@ -96,4 +96,5 @@ class ReactRefreshRspackPlugin {
96
96
  }
97
97
  }
98
98
  ReactRefreshRspackPlugin.deprecated_runtimePaths = paths_1.runtimePaths;
99
+ ReactRefreshRspackPlugin.loader = 'builtin:react-refresh-loader';
99
100
  module.exports = ReactRefreshRspackPlugin;
package/dist/options.d.ts CHANGED
@@ -46,6 +46,11 @@ export type PluginOptions = {
46
46
  * @default true
47
47
  */
48
48
  injectLoader?: boolean;
49
+ /**
50
+ * Whether to inject the client/reactRefreshEntry.js
51
+ * @default true
52
+ */
53
+ injectEntry?: boolean;
49
54
  };
50
55
  export interface NormalizedPluginOptions extends Required<PluginOptions> {
51
56
  overlay: false | OverlayOptions;
package/dist/options.js CHANGED
@@ -33,6 +33,7 @@ function normalizeOptions(options) {
33
33
  d(options, 'library');
34
34
  d(options, 'forceEnable', false);
35
35
  d(options, 'injectLoader', true);
36
+ d(options, 'injectEntry', true);
36
37
  options.overlay = normalizeOverlay(options.overlay);
37
38
  return options;
38
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/plugin-react-refresh",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "repository": "https://github.com/rspack-contrib/rspack-plugin-react-refresh",
5
5
  "license": "MIT",
6
6
  "description": "React refresh plugin for rspack",