ssr-plugin-react 6.2.11 → 6.2.12

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.
@@ -79,6 +79,13 @@ const getBaseConfig = (chain, isServer) => {
79
79
  .exclude
80
80
  .add(/node_modules|core-js/)
81
81
  .end();
82
+ chain.module
83
+ .rule('mjs')
84
+ .test(/\.mjs/)
85
+ .include
86
+ .add(/node_modules/).end()
87
+ .type('javascript/auto')
88
+ .end();
82
89
  const module = chain.module
83
90
  .rule('compileBabelForExtraModule')
84
91
  .test(/\.(js|mjs|jsx|ts|tsx)$/)
package/cjs/tools/vite.js CHANGED
@@ -6,7 +6,7 @@ const vite_1 = require("vite");
6
6
  const ssr_server_utils_1 = require("ssr-server-utils");
7
7
  const plugin_react_1 = require("@vitejs/plugin-react");
8
8
  const vite_plugin_style_import_1 = require("vite-plugin-style-import");
9
- const { getOutput, prefix, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = (0, ssr_server_utils_1.loadConfig)();
9
+ const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = (0, ssr_server_utils_1.loadConfig)();
10
10
  const { clientOutPut, serverOutPut } = getOutput();
11
11
  const styleImportConfig = {
12
12
  include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
@@ -51,14 +51,14 @@ const serverConfig = {
51
51
  },
52
52
  define: {
53
53
  __isBrowser__: false,
54
- ...define === null || define === void 0 ? void 0 : define.server,
55
- ...define === null || define === void 0 ? void 0 : define.base
54
+ ...define === null || define === void 0 ? void 0 : define.base,
55
+ ...define === null || define === void 0 ? void 0 : define.server
56
56
  }
57
57
  };
58
58
  exports.serverConfig = serverConfig;
59
59
  const clientConfig = {
60
60
  ...(0, ssr_server_utils_1.commonConfig)(),
61
- base: isDev ? '/' : prefix,
61
+ base: isDev ? '/' : (0, ssr_server_utils_1.getOutputPublicPath)(),
62
62
  esbuild: {
63
63
  keepNames: true
64
64
  },
@@ -83,8 +83,8 @@ const clientConfig = {
83
83
  },
84
84
  define: {
85
85
  __isBrowser__: true,
86
- ...define === null || define === void 0 ? void 0 : define.client,
87
- ...define === null || define === void 0 ? void 0 : define.base
86
+ ...define === null || define === void 0 ? void 0 : define.base,
87
+ ...define === null || define === void 0 ? void 0 : define.client
88
88
  }
89
89
  };
90
90
  exports.clientConfig = clientConfig;
@@ -76,6 +76,13 @@ const getBaseConfig = (chain, isServer) => {
76
76
  .exclude
77
77
  .add(/node_modules|core-js/)
78
78
  .end();
79
+ chain.module
80
+ .rule('mjs')
81
+ .test(/\.mjs/)
82
+ .include
83
+ .add(/node_modules/).end()
84
+ .type('javascript/auto')
85
+ .end();
79
86
  const module = chain.module
80
87
  .rule('compileBabelForExtraModule')
81
88
  .test(/\.(js|mjs|jsx|ts|tsx)$/)
package/esm/tools/vite.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
2
2
  import { build } from 'vite';
3
- import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin } from 'ssr-server-utils';
3
+ import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin, getOutputPublicPath } from 'ssr-server-utils';
4
4
  import react from '@vitejs/plugin-react';
5
5
  import styleImport, { AndDesignVueResolve, VantResolve, ElementPlusResolve, NutuiResolve, AntdResolve } from 'vite-plugin-style-import';
6
- const { getOutput, prefix, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = loadConfig();
6
+ const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = loadConfig();
7
7
  const { clientOutPut, serverOutPut } = getOutput();
8
8
  const styleImportConfig = {
9
9
  include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
@@ -48,13 +48,13 @@ const serverConfig = {
48
48
  },
49
49
  define: {
50
50
  __isBrowser__: false,
51
- ...define === null || define === void 0 ? void 0 : define.server,
52
- ...define === null || define === void 0 ? void 0 : define.base
51
+ ...define === null || define === void 0 ? void 0 : define.base,
52
+ ...define === null || define === void 0 ? void 0 : define.server
53
53
  }
54
54
  };
55
55
  const clientConfig = {
56
56
  ...commonConfig(),
57
- base: isDev ? '/' : prefix,
57
+ base: isDev ? '/' : getOutputPublicPath(),
58
58
  esbuild: {
59
59
  keepNames: true
60
60
  },
@@ -79,8 +79,8 @@ const clientConfig = {
79
79
  },
80
80
  define: {
81
81
  __isBrowser__: true,
82
- ...define === null || define === void 0 ? void 0 : define.client,
83
- ...define === null || define === void 0 ? void 0 : define.base
82
+ ...define === null || define === void 0 ? void 0 : define.base,
83
+ ...define === null || define === void 0 ? void 0 : define.client
84
84
  }
85
85
  };
86
86
  const viteStart = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssr-plugin-react",
3
- "version": "6.2.11",
3
+ "version": "6.2.12",
4
4
  "description": "plugin-react for ssr",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -85,6 +85,14 @@ const getBaseConfig = (chain: WebpackChain, isServer: boolean) => {
85
85
  .add(/node_modules|core-js/)
86
86
  .end()
87
87
 
88
+ chain.module
89
+ .rule('mjs')
90
+ .test(/\.mjs/)
91
+ .include
92
+ .add(/node_modules/).end()
93
+ .type('javascript/auto')
94
+ .end()
95
+
88
96
  const module = chain.module
89
97
  .rule('compileBabelForExtraModule')
90
98
  .test(/\.(js|mjs|jsx|ts|tsx)$/)
package/src/tools/vite.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { build, UserConfig } from 'vite'
2
- import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin } from 'ssr-server-utils'
2
+ import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin, getOutputPublicPath } from 'ssr-server-utils'
3
3
  import react from '@vitejs/plugin-react'
4
4
  import styleImport, { AndDesignVueResolve, VantResolve, ElementPlusResolve, NutuiResolve, AntdResolve } from 'vite-plugin-style-import'
5
- const { getOutput, prefix, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = loadConfig()
5
+ const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = loadConfig()
6
6
  const { clientOutPut, serverOutPut } = getOutput()
7
7
  const styleImportConfig = {
8
8
  include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
@@ -47,14 +47,14 @@ const serverConfig: UserConfig = {
47
47
  },
48
48
  define: {
49
49
  __isBrowser__: false,
50
- ...define?.server,
51
- ...define?.base
50
+ ...define?.base,
51
+ ...define?.server
52
52
  }
53
53
  }
54
54
 
55
55
  const clientConfig: UserConfig = {
56
56
  ...commonConfig(),
57
- base: isDev ? '/' : prefix,
57
+ base: isDev ? '/' : getOutputPublicPath(),
58
58
  esbuild: {
59
59
  keepNames: true
60
60
  },
@@ -79,8 +79,8 @@ const clientConfig: UserConfig = {
79
79
  },
80
80
  define: {
81
81
  __isBrowser__: true,
82
- ...define?.client,
83
- ...define?.base
82
+ ...define?.base,
83
+ ...define?.client
84
84
  }
85
85
  }
86
86
  const viteStart = async () => {