@modern-js/app-tools 2.5.0-alpha.1 → 2.5.1-alpha.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/cjs/analyze/generateCode.js +15 -23
- package/dist/cjs/analyze/getBundleEntry.js +1 -1
- package/dist/cjs/analyze/index.js +0 -4
- package/dist/cjs/analyze/templates.js +1 -6
- package/dist/cjs/builder/builder-webpack/builderPlugins/compatModern.js +3 -3
- package/dist/cjs/builder/builder-webpack/index.js +5 -11
- package/dist/cjs/builder/generator/getBuilderTargets.js +1 -1
- package/dist/cjs/commands/dev.js +14 -6
- package/dist/cjs/config/legacy/createToolsConfig.js +4 -1
- package/dist/esm/analyze/generateCode.js +28 -40
- package/dist/esm/analyze/getBundleEntry.js +2 -2
- package/dist/esm/analyze/index.js +0 -1
- package/dist/esm/analyze/templates.js +2 -3
- package/dist/esm/builder/builder-webpack/builderPlugins/compatModern.js +2 -2
- package/dist/esm/builder/builder-webpack/index.js +7 -11
- package/dist/esm/builder/generator/getBuilderTargets.js +1 -1
- package/dist/esm/commands/dev.js +8 -3
- package/dist/esm/config/legacy/createToolsConfig.js +4 -1
- package/dist/esm-node/analyze/generateCode.js +16 -24
- package/dist/esm-node/analyze/getBundleEntry.js +3 -2
- package/dist/esm-node/analyze/index.js +0 -4
- package/dist/esm-node/analyze/templates.js +1 -6
- package/dist/esm-node/builder/builder-webpack/builderPlugins/compatModern.js +2 -2
- package/dist/esm-node/builder/builder-webpack/index.js +6 -12
- package/dist/esm-node/builder/generator/getBuilderTargets.js +1 -1
- package/dist/esm-node/commands/dev.js +14 -6
- package/dist/esm-node/config/legacy/createToolsConfig.js +4 -1
- package/dist/js/modern/analyze/constants.js +1 -3
- package/dist/js/modern/analyze/index.js +48 -45
- package/dist/js/modern/analyze/nestedRoutes.js +2 -22
- package/dist/js/modern/analyze/templates.js +9 -2
- package/dist/js/modern/builder/{shared/builderPlugins/adapterModern.js → builderPlugins/compatModern.js} +111 -81
- package/dist/js/modern/builder/index.js +133 -13
- package/dist/js/modern/builder/loaders/routerLoader.js +17 -0
- package/dist/js/modern/builder/{shared/loaders → loaders}/serverModuleLoader.js +0 -0
- package/dist/js/modern/builder/{shared/createCopyPattern.js → share.js} +0 -0
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +30 -0
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +37 -0
- package/dist/js/modern/builder/{builder-webpack/webpackPlugins/RouterPlugin.js → webpackPlugins/routerPlugin.js} +1 -1
- package/dist/js/modern/config/default.js +2 -2
- package/dist/js/modern/config/index.js +8 -3
- package/dist/js/modern/config/{legacy → initial}/createHtmlConfig.js +0 -0
- package/dist/js/modern/config/{legacy → initial}/createOutputConfig.js +0 -0
- package/dist/js/modern/config/{legacy → initial}/createSourceConfig.js +0 -0
- package/dist/js/modern/config/{legacy → initial}/createToolsConfig.js +0 -0
- package/dist/js/modern/config/initial/index.js +16 -0
- package/dist/js/modern/config/{initialize → initial}/inits.js +2 -4
- package/dist/js/modern/config/{legacy/index.js → initial/transformNormalizedConfig.js} +0 -4
- package/dist/js/modern/index.js +8 -18
- package/dist/js/modern/initialize/index.js +28 -36
- package/dist/js/modern/locale/zh.js +1 -1
- package/dist/js/node/analyze/constants.js +1 -3
- package/dist/js/node/analyze/index.js +49 -46
- package/dist/js/node/analyze/nestedRoutes.js +2 -22
- package/dist/js/node/analyze/templates.js +9 -2
- package/dist/js/node/builder/{shared/builderPlugins/adapterModern.js → builderPlugins/compatModern.js} +115 -86
- package/dist/js/node/builder/index.js +123 -14
- package/dist/js/node/builder/{generator/getBuilderTargets.js → loaders/routerLoader.js} +16 -13
- package/dist/js/node/builder/{shared/loaders → loaders}/serverModuleLoader.js +0 -0
- package/dist/js/node/builder/{shared/createCopyPattern.js → share.js} +3 -3
- package/dist/js/node/builder/{shared/bundlerPlugins/HtmlAsyncChunkPlugin.js → webpackPlugins/htmlAsyncChunkPlugin.js} +20 -17
- package/dist/js/node/builder/{shared/bundlerPlugins/HtmlBottomTemplate.js → webpackPlugins/htmlBottomTemplate.js} +24 -21
- package/dist/js/node/builder/{builder-webpack/webpackPlugins/RouterPlugin.js → webpackPlugins/routerPlugin.js} +5 -7
- package/dist/js/node/config/default.js +2 -2
- package/dist/js/node/config/index.js +19 -4
- package/dist/js/node/config/{legacy → initial}/createHtmlConfig.js +0 -0
- package/dist/js/node/config/{legacy → initial}/createOutputConfig.js +0 -0
- package/dist/js/node/config/{legacy → initial}/createSourceConfig.js +0 -0
- package/dist/js/node/config/{legacy → initial}/createToolsConfig.js +0 -0
- package/dist/js/node/config/{initialize → initial}/index.js +16 -10
- package/dist/js/node/config/{initialize → initial}/inits.js +2 -4
- package/dist/js/node/config/{legacy/index.js → initial/transformNormalizedConfig.js} +3 -8
- package/dist/js/node/index.js +8 -18
- package/dist/js/node/initialize/index.js +28 -35
- package/dist/js/node/locale/zh.js +1 -1
- package/dist/js/treeshaking/analyze/constants.js +1 -3
- package/dist/js/treeshaking/analyze/index.js +130 -135
- package/dist/js/treeshaking/analyze/nestedRoutes.js +1 -17
- package/dist/js/treeshaking/analyze/templates.js +7 -3
- package/dist/js/treeshaking/builder/{shared/builderPlugins/adapterModern.js → builderPlugins/compatModern.js} +156 -103
- package/dist/js/treeshaking/builder/index.js +228 -29
- package/dist/js/treeshaking/builder/loaders/routerLoader.js +13 -0
- package/dist/js/treeshaking/builder/{shared/loaders → loaders}/serverModuleLoader.js +0 -0
- package/dist/js/treeshaking/builder/{shared/createCopyPattern.js → share.js} +0 -0
- package/dist/js/treeshaking/builder/{shared/bundlerPlugins/HtmlAsyncChunkPlugin.js → webpackPlugins/htmlAsyncChunkPlugin.js} +0 -0
- package/dist/js/treeshaking/builder/{shared/bundlerPlugins/HtmlBottomTemplate.js → webpackPlugins/htmlBottomTemplate.js} +0 -0
- package/dist/js/treeshaking/builder/{builder-webpack/webpackPlugins/RouterPlugin.js → webpackPlugins/routerPlugin.js} +1 -1
- package/dist/js/treeshaking/config/default.js +2 -2
- package/dist/js/treeshaking/config/index.js +3 -3
- package/dist/js/treeshaking/config/{legacy → initial}/createHtmlConfig.js +0 -0
- package/dist/js/treeshaking/config/{legacy → initial}/createOutputConfig.js +0 -0
- package/dist/js/treeshaking/config/{legacy → initial}/createSourceConfig.js +0 -0
- package/dist/js/treeshaking/config/{legacy → initial}/createToolsConfig.js +0 -0
- package/dist/js/treeshaking/config/initial/index.js +12 -0
- package/dist/js/treeshaking/config/{initialize → initial}/inits.js +2 -4
- package/dist/js/treeshaking/config/{legacy/index.js → initial/transformNormalizedConfig.js} +1 -4
- package/dist/js/treeshaking/index.js +12 -19
- package/dist/js/treeshaking/initialize/index.js +26 -34
- package/dist/js/treeshaking/locale/zh.js +1 -1
- package/dist/types/analyze/templates.d.ts +1 -3
- package/dist/types/builder/builder-webpack/builderPlugins/compatModern.d.ts +1 -7
- package/package.json +14 -14
- package/dist/js/modern/builder/builder-rspack/index.js +0 -8
- package/dist/js/modern/builder/builder-webpack/builderPlugins/compatModern.js +0 -41
- package/dist/js/modern/builder/builder-webpack/index.js +0 -93
- package/dist/js/modern/builder/builder-webpack/webpackPlugins/index.js +0 -1
- package/dist/js/modern/builder/generator/createBuilderOptions.js +0 -24
- package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +0 -39
- package/dist/js/modern/builder/generator/getBuilderTargets.js +0 -12
- package/dist/js/modern/builder/generator/index.js +0 -53
- package/dist/js/modern/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -27
- package/dist/js/modern/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -34
- package/dist/js/modern/builder/shared/index.js +0 -3
- package/dist/js/modern/builder/shared/types.js +0 -0
- package/dist/js/modern/config/initialize/index.js +0 -12
- package/dist/js/modern/types/utils.js +0 -0
- package/dist/js/node/builder/builder-rspack/index.js +0 -31
- package/dist/js/node/builder/builder-webpack/builderPlugins/compatModern.js +0 -64
- package/dist/js/node/builder/builder-webpack/index.js +0 -118
- package/dist/js/node/builder/builder-webpack/webpackPlugins/index.js +0 -17
- package/dist/js/node/builder/generator/createBuilderOptions.js +0 -47
- package/dist/js/node/builder/generator/createBuilderProviderConfig.js +0 -60
- package/dist/js/node/builder/generator/index.js +0 -82
- package/dist/js/node/builder/shared/index.js +0 -19
- package/dist/js/node/builder/shared/types.js +0 -15
- package/dist/js/node/types/utils.js +0 -15
- package/dist/js/treeshaking/builder/builder-rspack/index.js +0 -6
- package/dist/js/treeshaking/builder/builder-webpack/builderPlugins/compatModern.js +0 -64
- package/dist/js/treeshaking/builder/builder-webpack/index.js +0 -301
- package/dist/js/treeshaking/builder/builder-webpack/webpackPlugins/index.js +0 -1
- package/dist/js/treeshaking/builder/generator/createBuilderOptions.js +0 -41
- package/dist/js/treeshaking/builder/generator/createBuilderProviderConfig.js +0 -70
- package/dist/js/treeshaking/builder/generator/getBuilderTargets.js +0 -12
- package/dist/js/treeshaking/builder/generator/index.js +0 -199
- package/dist/js/treeshaking/builder/shared/index.js +0 -3
- package/dist/js/treeshaking/builder/shared/types.js +0 -1
- package/dist/js/treeshaking/config/initialize/index.js +0 -10
- package/dist/js/treeshaking/types/utils.js +0 -1
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithoutHoles(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
8
|
+
}
|
|
1
9
|
function _defineProperty(obj, key, value) {
|
|
2
10
|
if (key in obj) {
|
|
3
11
|
Object.defineProperty(obj, key, {
|
|
@@ -11,6 +19,12 @@ function _defineProperty(obj, key, value) {
|
|
|
11
19
|
}
|
|
12
20
|
return obj;
|
|
13
21
|
}
|
|
22
|
+
function _iterableToArray(iter) {
|
|
23
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
24
|
+
}
|
|
25
|
+
function _nonIterableSpread() {
|
|
26
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27
|
+
}
|
|
14
28
|
function _objectSpread(target) {
|
|
15
29
|
for(var i = 1; i < arguments.length; i++){
|
|
16
30
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -50,57 +64,32 @@ function _objectSpreadProps(target, source) {
|
|
|
50
64
|
}
|
|
51
65
|
return target;
|
|
52
66
|
}
|
|
67
|
+
function _toConsumableArray(arr) {
|
|
68
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
69
|
+
}
|
|
70
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
71
|
+
if (!o) return;
|
|
72
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
73
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
74
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
75
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
76
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
77
|
+
}
|
|
78
|
+
import { join } from "path";
|
|
53
79
|
import { mergeBuilderConfig } from "@modern-js/builder-shared";
|
|
54
|
-
import { getEntryOptions } from "@modern-js/utils";
|
|
55
|
-
import HtmlWebpackPlugin from "@modern-js/builder-webpack-provider/html-webpack-plugin";
|
|
56
80
|
import { template as lodashTemplate } from "@modern-js/utils/lodash";
|
|
57
|
-
import
|
|
58
|
-
import {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (isStreaming(server.ssr)) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && typeof server.ssrByEntries === "object") {
|
|
68
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
69
|
-
try {
|
|
70
|
-
for(var _iterator = Object.keys(server.ssrByEntries)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
71
|
-
var name = _step.value;
|
|
72
|
-
if (isStreaming(server.ssrByEntries[name])) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
} catch (err) {
|
|
77
|
-
_didIteratorError = true;
|
|
78
|
-
_iteratorError = err;
|
|
79
|
-
} finally{
|
|
80
|
-
try {
|
|
81
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
82
|
-
_iterator.return();
|
|
83
|
-
}
|
|
84
|
-
} finally{
|
|
85
|
-
if (_didIteratorError) {
|
|
86
|
-
throw _iteratorError;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return false;
|
|
92
|
-
};
|
|
93
|
-
var builderPluginAdapterModern = function(options) {
|
|
81
|
+
import HtmlWebpackPlugin from "@modern-js/builder-webpack-provider/html-webpack-plugin";
|
|
82
|
+
import { getEntryOptions } from "@modern-js/utils";
|
|
83
|
+
import { BottomTemplatePlugin } from "../webpackPlugins/htmlBottomTemplate";
|
|
84
|
+
import { HtmlAsyncChunkPlugin } from "../webpackPlugins/htmlAsyncChunkPlugin";
|
|
85
|
+
import { createCopyPattern } from "../share";
|
|
86
|
+
import RouterPlugin from "../webpackPlugins/routerPlugin";
|
|
87
|
+
var PluginCompatModern = function(appContext, modernConfig, options) {
|
|
94
88
|
return {
|
|
95
|
-
name: "builder-plugin-
|
|
89
|
+
name: "builder-plugin-compat-modern",
|
|
96
90
|
setup: function setup(api) {
|
|
97
|
-
var isHtmlEnabled = function isHtmlEnabled(config, target) {
|
|
98
|
-
var ref;
|
|
99
|
-
return ((ref = config.tools) === null || ref === void 0 ? void 0 : ref.htmlPlugin) !== false && target !== "node" && target !== "web-worker";
|
|
100
|
-
};
|
|
101
|
-
var normalizedConfig = options.normalizedConfig, appContext = options.appContext;
|
|
102
91
|
api.modifyBuilderConfig(function(config) {
|
|
103
|
-
if (isStreamingSSR(
|
|
92
|
+
if (isStreamingSSR(modernConfig)) {
|
|
104
93
|
return mergeBuilderConfig(config, {
|
|
105
94
|
html: {
|
|
106
95
|
inject: "body"
|
|
@@ -109,9 +98,14 @@ var builderPluginAdapterModern = function(options) {
|
|
|
109
98
|
}
|
|
110
99
|
return config;
|
|
111
100
|
});
|
|
112
|
-
api.
|
|
101
|
+
api.modifyWebpackChain(function(chain, param) {
|
|
113
102
|
var target = param.target, CHAIN_ID = param.CHAIN_ID, isProd = param.isProd;
|
|
114
|
-
var
|
|
103
|
+
var isHtmlEnabled = function isHtmlEnabled(config, target2) {
|
|
104
|
+
var ref;
|
|
105
|
+
return ((ref = config.tools) === null || ref === void 0 ? void 0 : ref.htmlPlugin) !== false && target2 !== "node" && target2 !== "web-worker";
|
|
106
|
+
};
|
|
107
|
+
var ref;
|
|
108
|
+
var builderNormalizedConfig = api.getNormalizedConfig();
|
|
115
109
|
if (target === "node") {
|
|
116
110
|
chain.name("server");
|
|
117
111
|
} else if (target === "modern-web") {
|
|
@@ -119,30 +113,55 @@ var builderPluginAdapterModern = function(options) {
|
|
|
119
113
|
} else {
|
|
120
114
|
chain.name("client");
|
|
121
115
|
}
|
|
116
|
+
chain.resolve.modules.add("node_modules").add(join(api.context.rootPath, "node_modules"));
|
|
122
117
|
if (target === "node") {
|
|
123
|
-
applyNodeCompat(chain,
|
|
118
|
+
applyNodeCompat(chain, modernConfig, isProd);
|
|
124
119
|
}
|
|
125
|
-
if (isHtmlEnabled(
|
|
126
|
-
|
|
120
|
+
if (isHtmlEnabled(builderNormalizedConfig, target)) {
|
|
121
|
+
applyBottomHtmlWebpackPlugin({
|
|
127
122
|
api: api,
|
|
128
123
|
chain: chain,
|
|
129
|
-
|
|
124
|
+
CHAIN_ID: CHAIN_ID,
|
|
130
125
|
appContext: appContext,
|
|
131
|
-
|
|
126
|
+
modernConfig: modernConfig
|
|
132
127
|
});
|
|
133
128
|
applyAsyncChunkHtmlPlugin({
|
|
134
129
|
chain: chain,
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
CHAIN_ID: CHAIN_ID,
|
|
131
|
+
modernConfig: modernConfig
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (chain.plugins.has(CHAIN_ID.PLUGIN.COPY)) {
|
|
135
|
+
var defaultCopyPattern = createCopyPattern(appContext, modernConfig, "public", chain);
|
|
136
|
+
chain.plugin(CHAIN_ID.PLUGIN.COPY).tap(function(args) {
|
|
137
|
+
var ref;
|
|
138
|
+
return [
|
|
139
|
+
{
|
|
140
|
+
patterns: _toConsumableArray(((ref = args[0]) === null || ref === void 0 ? void 0 : ref.patterns) || []).concat([
|
|
141
|
+
defaultCopyPattern
|
|
142
|
+
])
|
|
143
|
+
}
|
|
144
|
+
];
|
|
137
145
|
});
|
|
138
146
|
}
|
|
147
|
+
var entrypoints = appContext.entrypoints;
|
|
148
|
+
var existNestedRoutes = entrypoints.some(function(entrypoint) {
|
|
149
|
+
return entrypoint.nestedRoutesEntry;
|
|
150
|
+
});
|
|
151
|
+
var routerConfig = modernConfig === null || modernConfig === void 0 ? void 0 : (ref = modernConfig.runtime) === null || ref === void 0 ? void 0 : ref.router;
|
|
152
|
+
var routerManifest = Boolean(routerConfig === null || routerConfig === void 0 ? void 0 : routerConfig.manifest);
|
|
153
|
+
if (existNestedRoutes || routerManifest) {
|
|
154
|
+
chain.plugin("route-plugin").use(RouterPlugin);
|
|
155
|
+
}
|
|
139
156
|
if (target !== "node") {
|
|
140
157
|
var bareServerModuleReg = /\.(server|node)\.[tj]sx?$/;
|
|
141
158
|
chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(bareServerModuleReg);
|
|
142
159
|
chain.module.rule("bare-server-module").test(bareServerModuleReg).use("server-module-loader").loader(require.resolve("../loaders/serverModuleLoader"));
|
|
143
160
|
}
|
|
144
161
|
});
|
|
145
|
-
|
|
162
|
+
if (options) {
|
|
163
|
+
applyCallbacks(api, options);
|
|
164
|
+
}
|
|
146
165
|
}
|
|
147
166
|
};
|
|
148
167
|
};
|
|
@@ -156,7 +175,52 @@ function applyCallbacks(api, options) {
|
|
|
156
175
|
options.onDevCompileDone && api.onDevCompileDone(options.onDevCompileDone);
|
|
157
176
|
options.onExit && api.onExit(options.onExit);
|
|
158
177
|
}
|
|
159
|
-
function
|
|
178
|
+
function applyNodeCompat(chain, modernConfig, isProd) {
|
|
179
|
+
var filterEntriesBySSRConfig = function filterEntriesBySSRConfig(isProd2, chain2, serverConfig, outputConfig) {
|
|
180
|
+
var ref;
|
|
181
|
+
var entries = chain2.entryPoints.entries();
|
|
182
|
+
if (isProd2 && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (ref = outputConfig.ssg) === null || ref === void 0 ? void 0 : ref[0]) === "function")) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (typeof entries === "undefined") {
|
|
186
|
+
throw new Error("No entry found, one of src/routes/layout.tsx, src/App.tsx, src/index.tsx is required");
|
|
187
|
+
}
|
|
188
|
+
var entryNames = Object.keys(entries);
|
|
189
|
+
if (isProd2 && entryNames.length === 1 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
var ssgEntries = [];
|
|
193
|
+
if (isProd2 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
|
194
|
+
var ssg = outputConfig.ssg;
|
|
195
|
+
entryNames.forEach(function(name) {
|
|
196
|
+
if (ssg[name]) {
|
|
197
|
+
ssgEntries.push(name);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
var ref1 = serverConfig || {}, ssr = ref1.ssr, ssrByEntries = ref1.ssrByEntries;
|
|
202
|
+
entryNames.forEach(function(name) {
|
|
203
|
+
if (!ssgEntries.includes(name) && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]))) {
|
|
204
|
+
chain2.entryPoints.delete(name);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
for(var _i = 0, _iter = [
|
|
209
|
+
".node.js",
|
|
210
|
+
".node.jsx",
|
|
211
|
+
".node.ts",
|
|
212
|
+
".node.tsx",
|
|
213
|
+
".server.js",
|
|
214
|
+
".server.ts",
|
|
215
|
+
".server.ts",
|
|
216
|
+
".server.tsx"
|
|
217
|
+
]; _i < _iter.length; _i++){
|
|
218
|
+
var ext = _iter[_i];
|
|
219
|
+
chain.resolve.extensions.prepend(ext);
|
|
220
|
+
}
|
|
221
|
+
filterEntriesBySSRConfig(isProd, chain, modernConfig.server, modernConfig.output);
|
|
222
|
+
}
|
|
223
|
+
function applyBottomHtmlWebpackPlugin(param) {
|
|
160
224
|
var api = param.api, chain = param.chain, modernConfig = param.modernConfig, appContext = param.appContext, CHAIN_ID = param.CHAIN_ID;
|
|
161
225
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
162
226
|
try {
|
|
@@ -195,6 +259,40 @@ function applyBottomHtmlPlugin(param) {
|
|
|
195
259
|
HtmlWebpackPlugin
|
|
196
260
|
]);
|
|
197
261
|
}
|
|
262
|
+
var isStreamingSSR = function(userConfig) {
|
|
263
|
+
var isStreaming = function(ssr) {
|
|
264
|
+
return ssr && typeof ssr === "object" && ssr.mode === "stream";
|
|
265
|
+
};
|
|
266
|
+
var server = userConfig.server;
|
|
267
|
+
if (isStreaming(server.ssr)) {
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && typeof server.ssrByEntries === "object") {
|
|
271
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
272
|
+
try {
|
|
273
|
+
for(var _iterator = Object.keys(server.ssrByEntries)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
274
|
+
var name = _step.value;
|
|
275
|
+
if (isStreaming(server.ssrByEntries[name])) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
} catch (err) {
|
|
280
|
+
_didIteratorError = true;
|
|
281
|
+
_iteratorError = err;
|
|
282
|
+
} finally{
|
|
283
|
+
try {
|
|
284
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
285
|
+
_iterator.return();
|
|
286
|
+
}
|
|
287
|
+
} finally{
|
|
288
|
+
if (_didIteratorError) {
|
|
289
|
+
throw _iteratorError;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return false;
|
|
295
|
+
};
|
|
198
296
|
function applyAsyncChunkHtmlPlugin(param) {
|
|
199
297
|
var chain = param.chain, modernConfig = param.modernConfig, CHAIN_ID = param.CHAIN_ID;
|
|
200
298
|
if (isStreamingSSR(modernConfig)) {
|
|
@@ -203,49 +301,4 @@ function applyAsyncChunkHtmlPlugin(param) {
|
|
|
203
301
|
]);
|
|
204
302
|
}
|
|
205
303
|
}
|
|
206
|
-
|
|
207
|
-
var filterEntriesBySSRConfig = function filterEntriesBySSRConfig(isProd2, chain2, serverConfig, outputConfig) {
|
|
208
|
-
var ref;
|
|
209
|
-
var entries = chain2.entryPoints.entries();
|
|
210
|
-
if (isProd2 && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (ref = outputConfig.ssg) === null || ref === void 0 ? void 0 : ref[0]) === "function")) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
if (typeof entries === "undefined") {
|
|
214
|
-
throw new Error("No entry found, one of src/routes/layout.tsx, src/App.tsx, src/index.tsx is required");
|
|
215
|
-
}
|
|
216
|
-
var entryNames = Object.keys(entries);
|
|
217
|
-
if (isProd2 && entryNames.length === 1 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
var ssgEntries = [];
|
|
221
|
-
if (isProd2 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
|
222
|
-
var ssg = outputConfig.ssg;
|
|
223
|
-
entryNames.forEach(function(name) {
|
|
224
|
-
if (ssg[name]) {
|
|
225
|
-
ssgEntries.push(name);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
var ref1 = serverConfig || {}, ssr = ref1.ssr, ssrByEntries = ref1.ssrByEntries;
|
|
230
|
-
entryNames.forEach(function(name) {
|
|
231
|
-
if (!ssgEntries.includes(name) && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]))) {
|
|
232
|
-
chain2.entryPoints.delete(name);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
};
|
|
236
|
-
for(var _i = 0, _iter = [
|
|
237
|
-
".node.js",
|
|
238
|
-
".node.jsx",
|
|
239
|
-
".node.ts",
|
|
240
|
-
".node.tsx",
|
|
241
|
-
".server.js",
|
|
242
|
-
".server.ts",
|
|
243
|
-
".server.ts",
|
|
244
|
-
".server.tsx"
|
|
245
|
-
]; _i < _iter.length; _i++){
|
|
246
|
-
var ext = _iter[_i];
|
|
247
|
-
chain.resolve.extensions.prepend(ext);
|
|
248
|
-
}
|
|
249
|
-
filterEntriesBySSRConfig(isProd, chain, modernConfig.server, modernConfig.output);
|
|
250
|
-
}
|
|
251
|
-
export { applyCallbacks, builderPluginAdapterModern };
|
|
304
|
+
export { PluginCompatModern };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithoutHoles(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
8
|
+
}
|
|
1
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
10
|
try {
|
|
3
11
|
var info = gen[key](arg);
|
|
@@ -27,6 +35,75 @@ function _asyncToGenerator(fn) {
|
|
|
27
35
|
});
|
|
28
36
|
};
|
|
29
37
|
}
|
|
38
|
+
function _defineProperty(obj, key, value) {
|
|
39
|
+
if (key in obj) {
|
|
40
|
+
Object.defineProperty(obj, key, {
|
|
41
|
+
value: value,
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
obj[key] = value;
|
|
48
|
+
}
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
function _iterableToArray(iter) {
|
|
52
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
53
|
+
}
|
|
54
|
+
function _nonIterableSpread() {
|
|
55
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
56
|
+
}
|
|
57
|
+
function _objectSpread(target) {
|
|
58
|
+
for(var i = 1; i < arguments.length; i++){
|
|
59
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
60
|
+
var ownKeys = Object.keys(source);
|
|
61
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
62
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
63
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
ownKeys.forEach(function(key) {
|
|
67
|
+
_defineProperty(target, key, source[key]);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
function ownKeys(object, enumerableOnly) {
|
|
73
|
+
var keys = Object.keys(object);
|
|
74
|
+
if (Object.getOwnPropertySymbols) {
|
|
75
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
76
|
+
if (enumerableOnly) {
|
|
77
|
+
symbols = symbols.filter(function(sym) {
|
|
78
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
keys.push.apply(keys, symbols);
|
|
82
|
+
}
|
|
83
|
+
return keys;
|
|
84
|
+
}
|
|
85
|
+
function _objectSpreadProps(target, source) {
|
|
86
|
+
source = source != null ? source : {};
|
|
87
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
88
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
89
|
+
} else {
|
|
90
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
91
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return target;
|
|
95
|
+
}
|
|
96
|
+
function _toConsumableArray(arr) {
|
|
97
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
98
|
+
}
|
|
99
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
100
|
+
if (!o) return;
|
|
101
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
102
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
103
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
104
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
105
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
106
|
+
}
|
|
30
107
|
var __generator = this && this.__generator || function(thisArg, body) {
|
|
31
108
|
var f, y, t, g, _ = {
|
|
32
109
|
label: 0,
|
|
@@ -122,54 +199,176 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
122
199
|
};
|
|
123
200
|
}
|
|
124
201
|
};
|
|
125
|
-
|
|
126
|
-
|
|
202
|
+
import { createBuilder } from "@modern-js/builder";
|
|
203
|
+
import { builderWebpackProvider } from "@modern-js/builder-webpack-provider";
|
|
204
|
+
import { applyOptionsChain, isProd, isSSR, isUseSSRBundle } from "@modern-js/utils";
|
|
205
|
+
import { PluginCompatModern } from "./builderPlugins/compatModern";
|
|
206
|
+
import { createCopyPattern } from "./share";
|
|
207
|
+
function getBuilderTargets(normalizedConfig) {
|
|
208
|
+
var targets = [
|
|
209
|
+
"web"
|
|
210
|
+
];
|
|
211
|
+
var useNodeTarget = isProd() ? isUseSSRBundle(normalizedConfig) : isSSR(normalizedConfig);
|
|
212
|
+
if (useNodeTarget) {
|
|
213
|
+
targets.push("node");
|
|
214
|
+
}
|
|
215
|
+
return targets;
|
|
127
216
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
|
|
217
|
+
function createBuilderForModern(_) {
|
|
218
|
+
return _createBuilderForModern.apply(this, arguments);
|
|
219
|
+
}
|
|
220
|
+
function _createBuilderForModern() {
|
|
221
|
+
_createBuilderForModern = _asyncToGenerator(function(param) {
|
|
222
|
+
var normalizedConfig, appContext, compatPluginConfig, builderConfig, webpackProvider, target, builderOptions, builder;
|
|
131
223
|
return __generator(this, function(_state) {
|
|
132
224
|
switch(_state.label){
|
|
133
225
|
case 0:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
226
|
+
normalizedConfig = param.normalizedConfig, appContext = param.appContext, compatPluginConfig = param.compatPluginConfig;
|
|
227
|
+
builderConfig = createBuilderProviderConfig(normalizedConfig, appContext);
|
|
228
|
+
webpackProvider = builderWebpackProvider({
|
|
229
|
+
builderConfig: builderConfig
|
|
230
|
+
});
|
|
231
|
+
target = getBuilderTargets(normalizedConfig);
|
|
232
|
+
builderOptions = createBuilderOptions(target, appContext);
|
|
233
|
+
return [
|
|
234
|
+
4,
|
|
235
|
+
createBuilder(webpackProvider, builderOptions)
|
|
137
236
|
];
|
|
138
|
-
_state.label = 1;
|
|
139
237
|
case 1:
|
|
140
|
-
_state.
|
|
141
|
-
1,
|
|
142
|
-
3,
|
|
143
|
-
,
|
|
144
|
-
4
|
|
145
|
-
]);
|
|
238
|
+
builder = _state.sent();
|
|
146
239
|
return [
|
|
147
240
|
4,
|
|
148
|
-
|
|
241
|
+
applyBuilderPlugins(builder, normalizedConfig, appContext, compatPluginConfig)
|
|
149
242
|
];
|
|
150
243
|
case 2:
|
|
151
|
-
|
|
244
|
+
_state.sent();
|
|
152
245
|
return [
|
|
153
246
|
2,
|
|
154
|
-
|
|
247
|
+
builder
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
return _createBuilderForModern.apply(this, arguments);
|
|
253
|
+
}
|
|
254
|
+
function createBuilderProviderConfig(normalizedConfig, appContext) {
|
|
255
|
+
var createOutputConfig = function createOutputConfig(config, appContext2) {
|
|
256
|
+
var defaultCopyPattern = createCopyPattern(appContext2, config, "upload");
|
|
257
|
+
var copy = config.output.copy;
|
|
258
|
+
var copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
|
|
259
|
+
var builderCopy = _toConsumableArray(copyOptions || []).concat([
|
|
260
|
+
defaultCopyPattern
|
|
261
|
+
]);
|
|
262
|
+
return _objectSpreadProps(_objectSpread({}, config.output), {
|
|
263
|
+
copy: builderCopy,
|
|
264
|
+
cleanDistPath: false
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
var output = createOutputConfig(normalizedConfig, appContext);
|
|
268
|
+
var htmlConfig = _objectSpread({}, normalizedConfig.html);
|
|
269
|
+
if (!htmlConfig.template) {
|
|
270
|
+
htmlConfig.templateByEntries = _objectSpread({}, htmlConfig.templateByEntries, appContext.htmlTemplates);
|
|
271
|
+
}
|
|
272
|
+
return _objectSpreadProps(_objectSpread({}, normalizedConfig), {
|
|
273
|
+
output: output,
|
|
274
|
+
dev: _objectSpreadProps(_objectSpread({}, normalizedConfig.dev), {
|
|
275
|
+
port: appContext.port
|
|
276
|
+
}),
|
|
277
|
+
html: htmlConfig
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function createBuilderOptions(target, appContext) {
|
|
281
|
+
var entries = {};
|
|
282
|
+
var _entrypoints = appContext.entrypoints, entrypoints = _entrypoints === void 0 ? [] : _entrypoints, checkedEntries = appContext.checkedEntries;
|
|
283
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
284
|
+
try {
|
|
285
|
+
for(var _iterator = entrypoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
286
|
+
var _value = _step.value, entryName = _value.entryName, entry = _value.entry;
|
|
287
|
+
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (entryName in entries) {
|
|
291
|
+
entries[entryName].push(entry);
|
|
292
|
+
} else {
|
|
293
|
+
entries[entryName] = [
|
|
294
|
+
entry
|
|
295
|
+
];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
} catch (err) {
|
|
299
|
+
_didIteratorError = true;
|
|
300
|
+
_iteratorError = err;
|
|
301
|
+
} finally{
|
|
302
|
+
try {
|
|
303
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
304
|
+
_iterator.return();
|
|
305
|
+
}
|
|
306
|
+
} finally{
|
|
307
|
+
if (_didIteratorError) {
|
|
308
|
+
throw _iteratorError;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
cwd: appContext.appDirectory,
|
|
314
|
+
target: target,
|
|
315
|
+
configPath: appContext.configFile || void 0,
|
|
316
|
+
entry: entries,
|
|
317
|
+
framework: appContext.metaName
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function applyBuilderPlugins(builder, normalizedConfig, appContext, compatPluginConfig) {
|
|
321
|
+
return _applyBuilderPlugins.apply(this, arguments);
|
|
322
|
+
}
|
|
323
|
+
function _applyBuilderPlugins() {
|
|
324
|
+
_applyBuilderPlugins = _asyncToGenerator(function(builder, normalizedConfig, appContext, compatPluginConfig) {
|
|
325
|
+
var builderPluginNodePolyfill, _tools, esbuildOptions, builderPluginEsbuild;
|
|
326
|
+
return __generator(this, function(_state) {
|
|
327
|
+
switch(_state.label){
|
|
328
|
+
case 0:
|
|
329
|
+
if (!!normalizedConfig.output.disableNodePolyfill) return [
|
|
330
|
+
3,
|
|
331
|
+
2
|
|
155
332
|
];
|
|
156
|
-
case 3:
|
|
157
|
-
_ = _state.sent();
|
|
158
|
-
throw new Error("Failed to use rspack, please check if you have `@modern-js/builder-rspack-provider` installed");
|
|
159
|
-
case 4:
|
|
160
333
|
return [
|
|
161
334
|
4,
|
|
162
|
-
import("
|
|
335
|
+
import("@modern-js/builder-plugin-node-polyfill")
|
|
163
336
|
];
|
|
164
|
-
case
|
|
165
|
-
|
|
337
|
+
case 1:
|
|
338
|
+
builderPluginNodePolyfill = _state.sent().builderPluginNodePolyfill;
|
|
339
|
+
builder.addPlugins([
|
|
340
|
+
builderPluginNodePolyfill()
|
|
341
|
+
]);
|
|
342
|
+
_state.label = 2;
|
|
343
|
+
case 2:
|
|
344
|
+
if (!normalizedConfig.tools.esbuild) return [
|
|
345
|
+
3,
|
|
346
|
+
4
|
|
347
|
+
];
|
|
348
|
+
_tools = normalizedConfig.tools, esbuildOptions = _tools.esbuild;
|
|
166
349
|
return [
|
|
167
|
-
|
|
168
|
-
|
|
350
|
+
4,
|
|
351
|
+
import("@modern-js/builder-plugin-esbuild")
|
|
352
|
+
];
|
|
353
|
+
case 3:
|
|
354
|
+
builderPluginEsbuild = _state.sent().builderPluginEsbuild;
|
|
355
|
+
builder.addPlugins([
|
|
356
|
+
builderPluginEsbuild({
|
|
357
|
+
loader: false,
|
|
358
|
+
minimize: applyOptionsChain({}, esbuildOptions)
|
|
359
|
+
})
|
|
360
|
+
]);
|
|
361
|
+
_state.label = 4;
|
|
362
|
+
case 4:
|
|
363
|
+
builder.addPlugins([
|
|
364
|
+
PluginCompatModern(appContext, normalizedConfig, compatPluginConfig)
|
|
365
|
+
]);
|
|
366
|
+
return [
|
|
367
|
+
2
|
|
169
368
|
];
|
|
170
369
|
}
|
|
171
370
|
});
|
|
172
371
|
});
|
|
173
|
-
return
|
|
372
|
+
return _applyBuilderPlugins.apply(this, arguments);
|
|
174
373
|
}
|
|
175
|
-
export {
|
|
374
|
+
export { createBuilderForModern, createBuilderOptions, createBuilderProviderConfig };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { slash } from "@modern-js/utils";
|
|
2
|
+
function loader(source) {
|
|
3
|
+
this.cacheable();
|
|
4
|
+
var target = this._compiler.options.target;
|
|
5
|
+
if (target === "node" || Array.isArray(target) && target.includes("node")) {
|
|
6
|
+
return source;
|
|
7
|
+
}
|
|
8
|
+
var resourcePath = this.resourcePath;
|
|
9
|
+
var code = '\n export { default } from "'.concat(slash(resourcePath), '";\n ');
|
|
10
|
+
return code;
|
|
11
|
+
}
|
|
12
|
+
var routerLoader_default = loader;
|
|
13
|
+
export { routerLoader_default as default };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -51,11 +51,12 @@ function _objectSpreadProps(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import { createDefaultConfig as createDefaultBuilderConfig } from "@modern-js/builder-webpack-provider";
|
|
54
|
-
function createDefaultConfig(appContext
|
|
54
|
+
function createDefaultConfig(appContext) {
|
|
55
55
|
var defaultBuilderConfig = createDefaultBuilderConfig();
|
|
56
56
|
var dev = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.dev), {
|
|
57
57
|
port: void 0
|
|
58
58
|
});
|
|
59
|
+
var tools = _objectSpread({}, defaultBuilderConfig.tools);
|
|
59
60
|
var output = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.output), {
|
|
60
61
|
disableNodePolyfill: true
|
|
61
62
|
});
|
|
@@ -94,7 +95,6 @@ function createDefaultConfig(appContext, bundler) {
|
|
|
94
95
|
baseUrl: "/",
|
|
95
96
|
port: 8080
|
|
96
97
|
};
|
|
97
|
-
var tools = bundler === "webpack" ? _objectSpread({}, defaultBuilderConfig.tools) : void 0;
|
|
98
98
|
return {
|
|
99
99
|
source: source,
|
|
100
100
|
output: output,
|