@gravity-ui/app-builder 0.15.1-beta.2 → 0.15.1-beta.3
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.
|
@@ -74,9 +74,6 @@ async function buildDevServer(config) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
if (isSsr) {
|
|
78
|
-
throw new Error(`SSR is not supported in ${bundler}`);
|
|
79
|
-
}
|
|
80
77
|
rspackConfigs = [
|
|
81
78
|
await (0, config_1.rspackConfigFactory)({
|
|
82
79
|
webpackMode: "development" /* WebpackMode.Dev */,
|
|
@@ -84,6 +81,15 @@ async function buildDevServer(config) {
|
|
|
84
81
|
logger,
|
|
85
82
|
}),
|
|
86
83
|
];
|
|
84
|
+
if (isSsr) {
|
|
85
|
+
const ssrLogger = new logger_1.Logger('rspack(SSR)', config.verbose);
|
|
86
|
+
rspackConfigs.push(await (0, config_1.rspackConfigFactory)({
|
|
87
|
+
webpackMode: "development" /* WebpackMode.Dev */,
|
|
88
|
+
config: normalizedConfig,
|
|
89
|
+
logger: ssrLogger,
|
|
90
|
+
isSsr,
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
94
|
const publicPath = path.normalize(config.client.publicPathPrefix + '/build/');
|
|
89
95
|
const staticFolder = path.resolve(paths_1.default.appDist, 'public');
|
|
@@ -163,8 +169,9 @@ async function buildDevServer(config) {
|
|
|
163
169
|
options.proxy = proxy;
|
|
164
170
|
let server;
|
|
165
171
|
if (bundler === 'rspack') {
|
|
166
|
-
// Rspack multicompiler dont work with lazy compilation
|
|
167
|
-
|
|
172
|
+
// Rspack multicompiler dont work with lazy compilation.
|
|
173
|
+
// Pass a single config to avoid multicompiler when SSR disabled.
|
|
174
|
+
const compiler = (0, core_1.rspack)(isSsr ? rspackConfigs : rspackConfigs[0]);
|
|
168
175
|
server = new dev_server_1.RspackDevServer(options, compiler);
|
|
169
176
|
// Need to clean cache before start. https://github.com/web-infra-dev/rspack/issues/9025
|
|
170
177
|
(0, rspack_1.clearCacheDirectory)(rspackConfigs[0], logger);
|
|
@@ -74,10 +74,7 @@ function getHelperOptions({ webpackMode, config, logger, isSsr = false, }) {
|
|
|
74
74
|
isSsr,
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
const { config } = options;
|
|
79
|
-
const helperOptions = getHelperOptions(options);
|
|
80
|
-
const { isSsr, isEnvProduction } = helperOptions;
|
|
77
|
+
function configureExternals({ config, isSsr }) {
|
|
81
78
|
let externals = config.externals;
|
|
82
79
|
if (isSsr) {
|
|
83
80
|
externals =
|
|
@@ -88,6 +85,24 @@ async function webpackConfigFactory(options) {
|
|
|
88
85
|
module: config.ssr?.moduleType === 'esm',
|
|
89
86
|
});
|
|
90
87
|
}
|
|
88
|
+
return externals;
|
|
89
|
+
}
|
|
90
|
+
function prepareRspackExternals(externals) {
|
|
91
|
+
if (Array.isArray(externals)) {
|
|
92
|
+
const rspackExternals = {};
|
|
93
|
+
for (const ext of externals) {
|
|
94
|
+
if (typeof ext === 'object' && ext !== null) {
|
|
95
|
+
Object.assign(rspackExternals, ext);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return rspackExternals;
|
|
99
|
+
}
|
|
100
|
+
return externals;
|
|
101
|
+
}
|
|
102
|
+
async function webpackConfigFactory(options) {
|
|
103
|
+
const { config } = options;
|
|
104
|
+
const helperOptions = getHelperOptions(options);
|
|
105
|
+
const { isSsr, isEnvProduction } = helperOptions;
|
|
91
106
|
let webpackConfig = {
|
|
92
107
|
mode: isEnvProduction ? 'production' : 'development',
|
|
93
108
|
context: paths_1.default.app,
|
|
@@ -102,7 +117,7 @@ async function webpackConfigFactory(options) {
|
|
|
102
117
|
},
|
|
103
118
|
plugins: configureWebpackPlugins(helperOptions),
|
|
104
119
|
optimization: configureOptimization(helperOptions),
|
|
105
|
-
externals,
|
|
120
|
+
externals: configureExternals(helperOptions),
|
|
106
121
|
node: config.node,
|
|
107
122
|
watchOptions: configureWatchOptions(helperOptions),
|
|
108
123
|
ignoreWarnings: [/Failed to parse source map/],
|
|
@@ -147,7 +162,7 @@ async function rspackConfigFactory(options) {
|
|
|
147
162
|
},
|
|
148
163
|
plugins: configureRspackPlugins(helperOptions),
|
|
149
164
|
optimization: configureRspackOptimization(helperOptions),
|
|
150
|
-
|
|
165
|
+
externals: prepareRspackExternals(configureExternals(helperOptions)),
|
|
151
166
|
node: config.node,
|
|
152
167
|
watchOptions: configureWatchOptions(helperOptions),
|
|
153
168
|
ignoreWarnings: [/Failed to parse source map/],
|
|
@@ -33,6 +33,7 @@ exports.rspackCompilerHandlerFactory = rspackCompilerHandlerFactory;
|
|
|
33
33
|
const core_1 = require("@rspack/core");
|
|
34
34
|
const fs = __importStar(require("node:fs"));
|
|
35
35
|
const path = __importStar(require("node:path"));
|
|
36
|
+
const pretty_time_1 = require("../logger/pretty-time");
|
|
36
37
|
const paths_1 = __importDefault(require("../../common/paths"));
|
|
37
38
|
function clearCacheDirectory(config, logger) {
|
|
38
39
|
if (!config.cache) {
|
|
@@ -66,7 +67,7 @@ const generateAssetsManifest = (seed, files, entries) => {
|
|
|
66
67
|
};
|
|
67
68
|
}, {});
|
|
68
69
|
return {
|
|
69
|
-
|
|
70
|
+
...manifestFiles,
|
|
70
71
|
entrypoints,
|
|
71
72
|
};
|
|
72
73
|
};
|
|
@@ -111,7 +112,6 @@ function prepareRspackRules(webpackRules) {
|
|
|
111
112
|
}
|
|
112
113
|
return rspackRules;
|
|
113
114
|
}
|
|
114
|
-
const pretty_time_1 = require("../logger/pretty-time");
|
|
115
115
|
class RspackProgressPlugin extends core_1.rspack.ProgressPlugin {
|
|
116
116
|
_logger;
|
|
117
117
|
_state = {};
|
package/package.json
CHANGED