@docsvision/management-console-extension-build 6.2.6 → 6.2.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/vite.base.config.js +20 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docsvision/management-console-extension-build",
3
- "version": "6.2.6",
3
+ "version": "6.2.8",
4
4
  "description": "Helper tools for building Management Console extensions.",
5
5
  "scripts": {},
6
6
  "dependencies": {
@@ -1,11 +1,11 @@
1
1
  import { existsSync, readFileSync, writeFileSync } from "fs";
2
- import { defineConfig } from "vite";
2
+ import { defineConfig, esmExternalRequirePlugin } from "vite";
3
3
  import react from "@vitejs/plugin-react";
4
4
  import autoprefixer from "autoprefixer";
5
5
  import postcssCustomProperties from "postcss-custom-properties";
6
6
  import path from "path";
7
7
 
8
- const EXTERNAL_EXACT = new Set([
8
+ const EXTERNAL_EXACT = [
9
9
  "react",
10
10
  "react-dom",
11
11
  "@emotion/react",
@@ -16,18 +16,18 @@ const EXTERNAL_EXACT = new Set([
16
16
  "@mui/system",
17
17
  "@mui/private-theming",
18
18
  "@mui/x-tree-view",
19
- ]);
19
+ ];
20
+
21
+ const EXTERNAL_LIST = [
22
+ ...EXTERNAL_EXACT,
23
+ "^@emotion/react/.*",
24
+ "^@mui/styled-engine/.*",
25
+ "^@mui/material/.*",
26
+ "^@mui/system/.*",
27
+ "^@mui/private-theming/.*",
28
+ "^@mui/x-tree-view/.*"
29
+ ]
20
30
 
21
- const isExternal = (id) => {
22
- if (EXTERNAL_EXACT.has(id)) return true;
23
- if (id.startsWith("@emotion/react/")) return true;
24
- if (id.startsWith("@mui/styled-engine/")) return true;
25
- if (id.startsWith("@mui/material/")) return true;
26
- if (id.startsWith("@mui/system/")) return true;
27
- if (id.startsWith("@mui/private-theming/")) return true;
28
- if (id.startsWith("@mui/x-tree-view/")) return true;
29
- return false;
30
- };
31
31
 
32
32
  const globals = (id) => {
33
33
  if (id === "react") return "React";
@@ -106,7 +106,13 @@ export function getBaseConfig(
106
106
 
107
107
  return {
108
108
  define: { "process.env.NODE_ENV": JSON.stringify("production") },
109
- plugins: [react(), injectManagementConsoleCssPlugin],
109
+ plugins: [
110
+ esmExternalRequirePlugin({
111
+ external: EXTERNAL_LIST
112
+ }),
113
+ react(),
114
+ injectManagementConsoleCssPlugin
115
+ ],
110
116
  css: {
111
117
  postcss: { plugins: [autoprefixer(), postcssCustomProperties()] },
112
118
  devSourcemap: true,
@@ -130,7 +136,6 @@ export function getBaseConfig(
130
136
  formats: ["umd"],
131
137
  },
132
138
  rollupOptions: {
133
- external: isExternal,
134
139
  output: {
135
140
  format: "umd",
136
141
  name,