vike 0.4.246-commit-bdf9e49 → 0.4.246-commit-bb4b6db

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.
@@ -89,7 +89,7 @@ async function getViteInfo(viteConfigFromUserVikeApiOptions, viteContext) {
89
89
  // Show a warning because Vike supports Vite's CLI (as well as third-party CLIs).
90
90
  // - Encourage users to define a vite.config.js file that also works with Vite's CLI (and potentially other third-party CLIs).
91
91
  // - Vike-based frameworks, such as DocPress, allow their users to omit defining a vite.config.js file.
92
- assertWarning(viteConfigFromUserViteConfigFile, // Only show the warning if the user defined a vite.config.js file
92
+ assertWarning(!viteConfigFromUserViteConfigFile, // Only show the warning if the user defined a vite.config.js file
93
93
  "Omitting Vike's Vite plugin (inside your vite.config.js) is deprecated — make sure to always add Vike's Vite plugin https://vike.dev/vite-plugin", { onlyOnce: true });
94
94
  // Add Vike to plugins if not present.
95
95
  // Using a dynamic import because the script calling the Vike API may not live in the same place as vite.config.js, thus vike/plugin may resolved to two different node_modules/vike directories.
@@ -22,10 +22,22 @@ async function determineOptimizeDeps(config) {
22
22
  WORKAROUND_LATE_DISCOVERY.forEach((dep) => {
23
23
  const userRootDir = config.root;
24
24
  const resolved = requireResolveOptional({ importPath: dep, userRootDir, importerFilePath: null });
25
- if (resolved && resolved.startsWith(userRootDir)) {
25
+ const resolvedInsideRepo = resolved && resolved.startsWith(userRootDir);
26
+ if (resolvedInsideRepo) {
27
+ // We add `dep` only if `resolvedInsideRepo === true` otherwise Vite logs a warning like the following.
28
+ // - ```console
29
+ // [11:22:42.464][/examples/vue-full][npm run dev][stderr] Failed to resolve dependency: react/jsx-dev-runtime, present in client 'optimizeDeps.include'
30
+ // ```
31
+ // - ```console
32
+ // [12:24:53.225][/test/@cloudflare_vite-plugin/test-dev.test.ts][npm run dev][stderr] Failed to resolve dependency: @compiled/react/runtime, present in ssr 'optimizeDeps.include'
33
+ // ```
26
34
  includeClient.push(dep);
27
35
  includeServer.push(dep);
28
36
  }
37
+ else if (config.optimizeDeps.include?.includes(dep)) {
38
+ // Monorepo => always `resolvedInsideRepo === false` — we use this other approach to workaround missing 'react/jsx-dev-runtime'
39
+ includeServer.push(dep);
40
+ }
29
41
  });
30
42
  config.optimizeDeps.include = add(config.optimizeDeps.include, includeClient);
31
43
  config.optimizeDeps.entries = add(config.optimizeDeps.entries, entriesClient);
@@ -21,6 +21,8 @@ async function pluginViteConfigVikeExtensions() {
21
21
  }));
22
22
  const pluginsFromExtensions = (viteConfigFromExtensions.plugins ?? []);
23
23
  delete viteConfigFromExtensions.plugins;
24
+ // Avoid infinite loop
25
+ assertUsage(!pluginsFromExtensions.some((p) => p.name?.startsWith('vike:')), "Adding Vike's Vite plugin using +vite is forbidden");
24
26
  return [
25
27
  ...pluginsFromExtensions,
26
28
  {
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.246-commit-bdf9e49";
1
+ export declare const PROJECT_VERSION: "0.4.246-commit-bb4b6db";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.246-commit-bdf9e49';
2
+ export const PROJECT_VERSION = '0.4.246-commit-bb4b6db';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.246-commit-bdf9e49",
3
+ "version": "0.4.246-commit-bb4b6db",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {