@rspack/plugin-react-refresh 0.3.12 → 0.3.13
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/client/reactRefreshEntry.js +8 -0
- package/dist/index.js +10 -0
- package/dist/options.d.ts +1 -0
- package/dist/options.js +1 -0
- package/package.json +3 -4
@@ -37,6 +37,14 @@ var safeThis = (function () {
|
|
37
37
|
if (process.env.NODE_ENV !== "production") {
|
38
38
|
if (typeof safeThis !== "undefined") {
|
39
39
|
var $RefreshInjected$ = "__reactRefreshInjected";
|
40
|
+
// Namespace the injected flag (if necessary) for monorepo compatibility
|
41
|
+
if (
|
42
|
+
typeof __react_refresh_library__ !== "undefined" &&
|
43
|
+
__react_refresh_library__
|
44
|
+
) {
|
45
|
+
$RefreshInjected$ += "_" + __react_refresh_library__;
|
46
|
+
}
|
47
|
+
|
40
48
|
// Only inject the runtime if it hasn't been injected
|
41
49
|
if (!safeThis[$RefreshInjected$]) {
|
42
50
|
RefreshRuntime.injectIntoGlobalHook(safeThis);
|
package/dist/index.js
CHANGED
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
const path_1 = __importDefault(require("path"));
|
6
|
+
const core_1 = require("@rspack/core");
|
6
7
|
const options_1 = require("./options");
|
7
8
|
const reactRefreshPath = require.resolve("../client/reactRefresh.js");
|
8
9
|
const reactRefreshEntryPath = require.resolve("../client/reactRefreshEntry.js");
|
@@ -35,12 +36,21 @@ class ReactRefreshRspackPlugin {
|
|
35
36
|
$ReactRefreshRuntime$: reactRefreshPath
|
36
37
|
}).apply(compiler);
|
37
38
|
compiler.options.module.rules.unshift({
|
39
|
+
// @ts-expect-error
|
38
40
|
include: this.options.include,
|
41
|
+
// @ts-expect-error
|
39
42
|
exclude: {
|
40
43
|
or: [this.options.exclude, [...runtimePaths]].filter(Boolean)
|
41
44
|
},
|
42
45
|
use: "builtin:react-refresh-loader"
|
43
46
|
});
|
47
|
+
const definedModules = {
|
48
|
+
// For Mutiple Instance Mode
|
49
|
+
__react_refresh_library__: JSON.stringify(compiler.webpack.Template.toIdentifier(this.options.library ||
|
50
|
+
compiler.options.output.uniqueName ||
|
51
|
+
compiler.options.output.library))
|
52
|
+
};
|
53
|
+
new core_1.DefinePlugin(definedModules).apply(compiler);
|
44
54
|
const refreshPath = path_1.default.dirname(require.resolve("react-refresh"));
|
45
55
|
compiler.options.resolve.alias = {
|
46
56
|
"react-refresh": refreshPath,
|
package/dist/options.d.ts
CHANGED
package/dist/options.js
CHANGED
@@ -11,6 +11,7 @@ const d = (object, property, defaultValue) => {
|
|
11
11
|
function normalizeOptions(options) {
|
12
12
|
d(options, "exclude", /node_modules/i);
|
13
13
|
d(options, "include", /\.([cm]js|[jt]sx?|flow)$/i);
|
14
|
+
d(options, "library");
|
14
15
|
return options;
|
15
16
|
}
|
16
17
|
exports.normalizeOptions = normalizeOptions;
|
package/package.json
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspack/plugin-react-refresh",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.13",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "React refresh plugin for rspack",
|
6
6
|
"main": "dist/index.js",
|
7
7
|
"types": "dist/index.d.ts",
|
8
8
|
"exports": {
|
9
9
|
".": {
|
10
|
-
"types": "./dist/index.d.ts",
|
11
10
|
"default": "./dist/index.js"
|
12
11
|
},
|
13
12
|
"./react-refresh": "./client/reactRefresh.js",
|
@@ -33,8 +32,8 @@
|
|
33
32
|
},
|
34
33
|
"devDependencies": {
|
35
34
|
"react-refresh": "0.14.0",
|
36
|
-
"@rspack/core": "0.3.
|
37
|
-
"@rspack/plugin-react-refresh": "0.3.
|
35
|
+
"@rspack/core": "0.3.13",
|
36
|
+
"@rspack/plugin-react-refresh": "0.3.13"
|
38
37
|
},
|
39
38
|
"peerDependencies": {
|
40
39
|
"react-refresh": ">=0.10.0 <1.0.0"
|