@octanejs/rspack-plugin 0.2.10 → 0.2.11
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/README.md +4 -0
- package/package.json +3 -3
- package/src/plugin.js +16 -1
package/README.md
CHANGED
|
@@ -173,6 +173,10 @@ export default {
|
|
|
173
173
|
};
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
+
For an SSR build, the class plugin resolves `octane/react` to the selected
|
|
177
|
+
Octane package's server implementation. Use `octane/react/server` explicitly
|
|
178
|
+
when a server externalizes the compatibility entry or uses the loader alone.
|
|
179
|
+
|
|
176
180
|
With the loader-only form, configure `.tsrx` resolution, TypeScript stripping,
|
|
177
181
|
and exact `octane$` / `octane/profiling$` aliases to the app's Octane package
|
|
178
182
|
yourself. The profiling alias keeps compiler metadata and runtime recording on
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/rspack-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@rspack/core": "^2.0.0",
|
|
48
|
-
"octane": "^0.
|
|
48
|
+
"octane": "^0.19.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@rspack/core": "^2.1.4",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/node": "^24.13.3",
|
|
54
54
|
"css-loader": "6.11.0",
|
|
55
55
|
"jsdom": "^30.0.1",
|
|
56
|
-
"octane": "0.
|
|
56
|
+
"octane": "0.19.0",
|
|
57
57
|
"vitest": "^4.1.10"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
package/src/plugin.js
CHANGED
|
@@ -96,7 +96,7 @@ function mergeRuntimeAliases(aliases, additions) {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
function addRuntimeAliases(compiler, request, root, explicitRuntime) {
|
|
99
|
+
function addRuntimeAliases(compiler, request, root, explicitRuntime, environment) {
|
|
100
100
|
const resolveOptions = compiler.options.resolve;
|
|
101
101
|
// The factory is created before Rspack applies mode/target defaults. Merge
|
|
102
102
|
// the finalized ESM options (including `...`) before resolving; require
|
|
@@ -123,6 +123,20 @@ function addRuntimeAliases(compiler, request, root, explicitRuntime) {
|
|
|
123
123
|
aliases[subpath] ??
|
|
124
124
|
resolveRuntimeModule(packageResolver, subpath, packageRoot);
|
|
125
125
|
}
|
|
126
|
+
if (environment === 'server') {
|
|
127
|
+
const serverRequest = 'octane/react/server';
|
|
128
|
+
const aliasedServer =
|
|
129
|
+
Object.hasOwn(aliases, 'octane/react/server$') || Object.hasOwn(aliases, serverRequest);
|
|
130
|
+
const serverReact = aliasedServer
|
|
131
|
+
? serverRequest
|
|
132
|
+
: resolveRuntimeModule(packageResolver, serverRequest, packageRoot);
|
|
133
|
+
if (aliasedServer || serverReact !== serverRequest) {
|
|
134
|
+
if (!aliasedServer) additions['octane/react/server$'] = serverReact;
|
|
135
|
+
// Keep the second request visible to Rspack's issuer-layer aliases.
|
|
136
|
+
if (!Object.hasOwn(aliases, 'octane/react$') && !Object.hasOwn(aliases, 'octane/react'))
|
|
137
|
+
additions['octane/react$'] = serverRequest;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
126
140
|
const runtime = explicitRuntime
|
|
127
141
|
? override
|
|
128
142
|
: request === 'octane' || selected === false
|
|
@@ -701,6 +715,7 @@ export class OctaneRspackPlugin {
|
|
|
701
715
|
runtimeRequest,
|
|
702
716
|
root,
|
|
703
717
|
this.options.runtime !== undefined,
|
|
718
|
+
environment,
|
|
704
719
|
);
|
|
705
720
|
for (const [alias, request] of layerRuntimeAliases) {
|
|
706
721
|
alias.octane$ = resolveRuntimeModule(resolver, request, root);
|