@shuvi/service 1.0.2 → 1.0.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.
package/lib/bundler/bundler.js
CHANGED
|
@@ -338,13 +338,11 @@ class WebpackBundler {
|
|
|
338
338
|
}));
|
|
339
339
|
}
|
|
340
340
|
_initDefaultBuildTarget() {
|
|
341
|
-
const defaultWebpackHelpers = (0, config_1.webpackHelpers)();
|
|
342
341
|
const defaultChain = (0, config_2.createWebpackConfig)(this._cliContext, {
|
|
343
342
|
name: constants_1.BUNDLER_TARGET_CLIENT,
|
|
344
343
|
node: false,
|
|
345
344
|
entry: {},
|
|
346
|
-
outputDir: constants_2.CLIENT_OUTPUT_DIR
|
|
347
|
-
webpackHelpers: defaultWebpackHelpers
|
|
345
|
+
outputDir: constants_2.CLIENT_OUTPUT_DIR
|
|
348
346
|
});
|
|
349
347
|
return [
|
|
350
348
|
{
|
|
@@ -357,7 +355,6 @@ class WebpackBundler {
|
|
|
357
355
|
var _a;
|
|
358
356
|
return __awaiter(this, void 0, void 0, function* () {
|
|
359
357
|
const targets = [];
|
|
360
|
-
const defaultWebpackHelpers = (0, config_1.webpackHelpers)();
|
|
361
358
|
// get base config
|
|
362
359
|
const buildTargets = this._initDefaultBuildTarget();
|
|
363
360
|
const extraTargets = (yield this._cliContext.pluginRunner.addExtraTarget({
|
|
@@ -366,6 +363,7 @@ class WebpackBundler {
|
|
|
366
363
|
webpack: webpack_1.webpack
|
|
367
364
|
})).filter(Boolean);
|
|
368
365
|
buildTargets.push(...extraTargets);
|
|
366
|
+
const defaultWebpackHelpers = { addExternals: config_1.addExternals };
|
|
369
367
|
for (const buildTarget of buildTargets) {
|
|
370
368
|
let { chain, name } = buildTarget;
|
|
371
369
|
// modify config by api hooks
|
|
@@ -378,6 +376,7 @@ class WebpackBundler {
|
|
|
378
376
|
return (0, webpack_1.resolveWebpackModule)(path);
|
|
379
377
|
}
|
|
380
378
|
});
|
|
379
|
+
(0, config_1.checkWebpackExternals)(chain);
|
|
381
380
|
if (hasEntry(chain)) {
|
|
382
381
|
const chainConfig = chain.toConfig();
|
|
383
382
|
logger_1.default.debug(`${name} Config`);
|
package/lib/bundler/config.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { WebpackChain } from '@shuvi/toolpack/lib/webpack/config';
|
|
2
2
|
import { IPluginContext } from '../core';
|
|
3
|
-
import { IWebpackHelpers } from '@shuvi/toolpack/lib/webpack/types';
|
|
4
3
|
export interface IWebpackEntry {
|
|
5
4
|
[x: string]: string | string[];
|
|
6
5
|
}
|
|
@@ -10,6 +9,5 @@ export interface IWebpackConfigOptions {
|
|
|
10
9
|
entry: IWebpackEntry;
|
|
11
10
|
include?: string[];
|
|
12
11
|
outputDir?: string;
|
|
13
|
-
webpackHelpers: IWebpackHelpers;
|
|
14
12
|
}
|
|
15
|
-
export declare function createWebpackConfig({ mode, assetPublicPath, paths, config }: IPluginContext, {
|
|
13
|
+
export declare function createWebpackConfig({ mode, assetPublicPath, paths, config }: IPluginContext, { ...opts }: IWebpackConfigOptions): WebpackChain;
|
package/lib/bundler/config.js
CHANGED
|
@@ -16,7 +16,7 @@ const config_1 = require("@shuvi/toolpack/lib/webpack/config");
|
|
|
16
16
|
const typescript_1 = require("./typescript");
|
|
17
17
|
const AppSourceRegexp = /([/\\]shuvi-app[/\\])|([/\\]\.shuvi[/\\])/;
|
|
18
18
|
function createWebpackConfig({ mode, assetPublicPath, paths, config }, _a) {
|
|
19
|
-
var
|
|
19
|
+
var opts = __rest(_a, []);
|
|
20
20
|
const dev = mode === 'development';
|
|
21
21
|
let chain;
|
|
22
22
|
const name = opts.name;
|
|
@@ -49,8 +49,7 @@ function createWebpackConfig({ mode, assetPublicPath, paths, config }, _a) {
|
|
|
49
49
|
compiler,
|
|
50
50
|
jsConfig,
|
|
51
51
|
include,
|
|
52
|
-
env
|
|
53
|
-
webpackHelpers
|
|
52
|
+
env
|
|
54
53
|
});
|
|
55
54
|
}
|
|
56
55
|
else {
|
|
@@ -66,7 +65,6 @@ function createWebpackConfig({ mode, assetPublicPath, paths, config }, _a) {
|
|
|
66
65
|
jsConfig,
|
|
67
66
|
include,
|
|
68
67
|
env,
|
|
69
|
-
webpackHelpers,
|
|
70
68
|
analyze: config.analyze
|
|
71
69
|
});
|
|
72
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuvi/service",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/shuvijs/shuvi.git",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"@babel/generator": "7.14.5",
|
|
30
30
|
"@babel/parser": "7.14.7",
|
|
31
31
|
"@babel/traverse": "7.14.7",
|
|
32
|
-
"@shuvi/hook": "1.0.
|
|
33
|
-
"@shuvi/router": "1.0.
|
|
34
|
-
"@shuvi/runtime": "1.0.
|
|
35
|
-
"@shuvi/shared": "1.0.
|
|
36
|
-
"@shuvi/toolpack": "1.0.
|
|
37
|
-
"@shuvi/utils": "1.0.
|
|
38
|
-
"@shuvi/error-overlay": "1.0.
|
|
32
|
+
"@shuvi/hook": "1.0.3",
|
|
33
|
+
"@shuvi/router": "1.0.3",
|
|
34
|
+
"@shuvi/runtime": "1.0.3",
|
|
35
|
+
"@shuvi/shared": "1.0.3",
|
|
36
|
+
"@shuvi/toolpack": "1.0.3",
|
|
37
|
+
"@shuvi/utils": "1.0.3",
|
|
38
|
+
"@shuvi/error-overlay": "1.0.3",
|
|
39
39
|
"commander": "5.1.0",
|
|
40
40
|
"comment-json": "4.2.2",
|
|
41
41
|
"cross-spawn": "7.0.3",
|