@moneko/core 3.0.0-beta.104 → 3.0.0-beta.106

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/common.js CHANGED
@@ -157,7 +157,8 @@ const defaultConfig = {
157
157
  color: '#6f42c1'
158
158
  },
159
159
  virtualModule: {},
160
- normalizeCss: true
160
+ normalizeCss: true,
161
+ externalsPresets: {}
161
162
  };
162
163
  export const log = (msg)=>{
163
164
  readline.cursorTo(process.stdout, 0);
@@ -42,7 +42,8 @@ const entryResolveProgramPath = [
42
42
  'example',
43
43
  'mock',
44
44
  'site',
45
- 'src'
45
+ 'src',
46
+ 'server'
46
47
  ].map(resolveProgramPath);
47
48
  const lessLoaderRule = [
48
49
  styleLoader,
@@ -1,5 +1,4 @@
1
1
  import './cleanup.js';
2
2
  import type { WebpackConfiguration } from 'webpack-dev-server';
3
3
  export declare const outputConfig: WebpackConfiguration['output'];
4
- declare const config: WebpackConfiguration;
5
- export default config;
4
+ export declare const clientConfig: WebpackConfiguration;
@@ -104,13 +104,14 @@ if (CONFIG.output) {
104
104
  const dirDeep = CONFIG.routeBaseName.split('/').filter(Boolean).length;
105
105
  const page404 = `${Array(dirDeep).fill('..').join('/') + (dirDeep ? '/' : '')}404.html`;
106
106
  const { pathSegmentsToKeep =dirDeep , path =page404 } = CONFIG.fixBrowserRouter || {};
107
- const config = {
107
+ export const clientConfig = {
108
108
  entry: entryMap,
109
109
  stats: 'errors-only',
110
110
  infrastructureLogging: {
111
111
  level: 'none'
112
112
  },
113
113
  target: 'web',
114
+ externalsPresets: CONFIG.externalsPresets,
114
115
  plugins: [
115
116
  new AutomaticPrefetchPlugin(),
116
117
  ...moduleFederation,
@@ -213,4 +214,3 @@ const config = {
213
214
  externals: CONFIG.externals,
214
215
  output: outputConfig
215
216
  };
216
- export default config;
@@ -1,3 +1,3 @@
1
1
  import webpack from 'webpack';
2
- declare const _default: webpack.Configuration;
2
+ declare const _default: webpack.Configuration[];
3
3
  export default _default;
@@ -7,7 +7,7 @@ import { hasPkg } from './has-pkg.js';
7
7
  import { getIPv4, getPort } from './net.js';
8
8
  import { CUSTOMCONFIG, isReact } from './process-env.js';
9
9
  import { isFunction, resolveProgramPath } from './utils.js';
10
- import common from './webpack.common.js';
10
+ import { clientConfig } from './webpack.common.js';
11
11
  const { HotModuleReplacementPlugin } = webpack;
12
12
  const { yellow , green } = chalk;
13
13
  const ip = getIPv4();
@@ -31,7 +31,7 @@ CONFIG.devServer.port = port;
31
31
  const initRouteBase = CONFIG.routeBaseName === '/';
32
32
  const protocol = CONFIG.devServer.https ? 'https:' : 'http:';
33
33
  const routeBase = initRouteBase ? '' : CONFIG.routeBaseName;
34
- export default merge(common, {
34
+ const client = merge(clientConfig, {
35
35
  devtool: devtool,
36
36
  mode: 'development',
37
37
  cache: cacheConfig,
@@ -92,3 +92,6 @@ export default merge(common, {
92
92
  })
93
93
  ].filter(Boolean)
94
94
  });
95
+ export default [
96
+ client
97
+ ];
@@ -1,3 +1,3 @@
1
1
  import webpack from 'webpack';
2
- declare const _default: webpack.Configuration;
2
+ declare const _default: webpack.Configuration[];
3
3
  export default _default;
@@ -7,7 +7,7 @@ import { merge } from 'webpack-merge';
7
7
  import { CONFIG } from './common.js';
8
8
  import { getMinifyOption } from './minify.js';
9
9
  import { CUSTOMCONFIG } from './process-env.js';
10
- import common from './webpack.common.js';
10
+ import { clientConfig } from './webpack.common.js';
11
11
  const { optimize } = webpack;
12
12
  const { cssnanoMinify , swcMinify } = CssMinimizerPlugin;
13
13
  const defaultJsMiniify = CONFIG.compiler === 'swc' ? 'swc' : 'terser';
@@ -48,7 +48,7 @@ if (CONFIG.cacheDirectory) {
48
48
  name: `${CUSTOMCONFIG || 'default'}-production`
49
49
  };
50
50
  }
51
- export default merge(common, {
51
+ const client = merge(clientConfig, {
52
52
  devtool: CONFIG.devtool === false || CONFIG.devtool ? CONFIG.devtool : 'cheap-module-source-map',
53
53
  mode: 'production',
54
54
  cache: cacheConfig,
@@ -65,3 +65,6 @@ export default merge(common, {
65
65
  })
66
66
  ].filter(Boolean)
67
67
  });
68
+ export default [
69
+ client
70
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.0.0-beta.104",
3
+ "version": "3.0.0-beta.106",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "webpack": "5.77.0",
42
42
  "webpack-bundle-analyzer": "4.9.0",
43
43
  "webpack-cli": "5.1.4",
44
- "webpack-dev-server": "4.15.0",
44
+ "webpack-dev-server": "4.15.1",
45
45
  "webpack-merge": "5.9.0",
46
46
  "webpack-virtual-modules": "0.5.0",
47
47
  "webpackbar": "5.0.2",
@@ -6,7 +6,7 @@ import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
6
6
  import type { CssNanoOptionsExtended } from 'css-minimizer-webpack-plugin';
7
7
  import type { MinifyOptions } from 'terser';
8
8
  import type { Options } from 'ts-import-plugin';
9
- import type { Configuration, RuleSetRule, WebpackPluginInstance } from 'webpack';
9
+ import type { Configuration, ExternalsPresets, RuleSetRule, WebpackPluginInstance } from 'webpack';
10
10
  import type {
11
11
  ProxyArray,
12
12
  ProxyConfigArray,
@@ -294,6 +294,7 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
294
294
  * @default true
295
295
  */
296
296
  normalizeCss?: boolean;
297
+ externalsPresets?: ExternalsPresets;
297
298
  };
298
299
  export declare interface ModuleFederationOption {
299
300
  /** 模块名称,唯一性,不能重名 */