@shellui/cli 0.0.16 → 0.0.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shellui/cli",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "ShellUI CLI - Command-line tool for ShellUI",
5
5
  "main": "src/cli.js",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "tsx": "^4.21.0",
31
31
  "vite": "7.3.1",
32
32
  "workbox-build": "^7.1.0",
33
- "@shellui/core": "0.0.16"
33
+ "@shellui/core": "0.0.18"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -87,6 +87,13 @@ export async function buildCommand(root = '.') {
87
87
  define: createViteDefine(config),
88
88
  resolve: {
89
89
  alias: resolveAlias,
90
+ // Dedupe React and core package to prevent duplicate module instances
91
+ // This is critical for React Context to work correctly in micro-frontends
92
+ dedupe: ['react', 'react-dom', '@shellui/core'],
93
+ // Ensure consistent module resolution to prevent duplicate instances
94
+ // when the same module is imported via different paths (relative, alias, with/without extensions)
95
+ conditions: ['import', 'module', 'browser', 'default'],
96
+ preserveSymlinks: false,
90
97
  },
91
98
  css: {
92
99
  postcss: postcssConfig,
@@ -125,6 +132,8 @@ export async function buildCommand(root = '.') {
125
132
  define: createViteDefine(config),
126
133
  resolve: {
127
134
  alias: resolveAlias,
135
+ // Dedupe React and core package to prevent duplicate module instances
136
+ dedupe: ['react', 'react-dom', '@shellui/core'],
128
137
  },
129
138
  build: {
130
139
  outDir: distPath,
@@ -43,6 +43,15 @@ async function startServer(root, cwd, shouldOpen = false) {
43
43
  define: createViteDefine(config),
44
44
  resolve: {
45
45
  alias: createResolveAlias(),
46
+ // Dedupe React and core package to prevent duplicate module instances
47
+ // This is critical for React Context to work correctly in micro-frontends
48
+ // When React is a peer dependency, dedupe ensures Vite uses a single instance
49
+ dedupe: ['react', 'react-dom', '@shellui/core'],
50
+ // Ensure consistent module resolution to prevent duplicate instances
51
+ // when the same module is imported via different paths (relative, alias, with/without extensions)
52
+ conditions: ['import', 'module', 'browser', 'default'],
53
+ // Don't preserve symlinks - ensures consistent resolution in monorepos
54
+ preserveSymlinks: false,
46
55
  },
47
56
  css: {
48
57
  postcss: createPostCSSConfig(),
@@ -35,6 +35,11 @@ export function serviceWorkerDevPlugin(corePackagePath, coreSrcPath) {
35
35
  plugins: [react()],
36
36
  resolve: {
37
37
  alias: createResolveAlias(),
38
+ // Dedupe React and core package to prevent duplicate module instances
39
+ dedupe: ['react', 'react-dom', '@shellui/core'],
40
+ // Ensure consistent module resolution to prevent duplicate instances
41
+ conditions: ['import', 'module', 'browser', 'default'],
42
+ preserveSymlinks: false,
38
43
  },
39
44
  build: {
40
45
  write: false,
package/src/utils/vite.js CHANGED
@@ -38,14 +38,19 @@ export function getCoreSrcPath() {
38
38
  * Always sets '@' to core/src. Sets '@shellui/sdk' to source entry when in
39
39
  * workspace mode; omits the alias when installed from npm so Vite resolves
40
40
  * through the package's exports field (dist/index.js).
41
+ *
42
+ * Also adds specific aliases for config module to ensure all imports
43
+ * (relative, alias, or with extensions) resolve to the same module instance.
44
+ * This prevents React Context duplication issues.
41
45
  * @returns {Object} Vite resolve.alias object
42
46
  */
43
47
  export function createResolveAlias() {
44
48
  const corePackagePath = resolvePackagePath('@shellui/core');
49
+ const coreSrcPath = path.join(corePackagePath, 'src');
45
50
  const sdkEntry = resolveSdkEntry();
46
51
 
47
52
  const alias = {
48
- '@': path.join(corePackagePath, 'src'),
53
+ '@': coreSrcPath,
49
54
  };
50
55
 
51
56
  if (sdkEntry) {