@nx/vite 22.1.0-beta.2 → 22.1.0-beta.3

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": "@nx/vite",
3
- "version": "22.1.0-beta.2",
3
+ "version": "22.1.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for building and testing applications using Vite",
6
6
  "repository": {
@@ -30,10 +30,10 @@
30
30
  "migrations": "./migrations.json"
31
31
  },
32
32
  "dependencies": {
33
- "@nx/devkit": "22.1.0-beta.2",
33
+ "@nx/devkit": "22.1.0-beta.3",
34
34
  "@phenomnomnominal/tsquery": "~5.0.1",
35
35
  "enquirer": "~2.3.6",
36
- "@nx/js": "22.1.0-beta.2",
36
+ "@nx/js": "22.1.0-beta.3",
37
37
  "picomatch": "4.0.2",
38
38
  "tsconfig-paths": "^4.1.2",
39
39
  "semver": "^7.6.3",
@@ -41,7 +41,7 @@
41
41
  "ajv": "^8.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "nx": "22.1.0-beta.2"
44
+ "nx": "22.1.0-beta.3"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -105,6 +105,18 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
105
105
  catch {
106
106
  // do nothing
107
107
  }
108
+ // Workaround for race condition with ESM-only Vite plugins (e.g. @vitejs/plugin-vue@6+)
109
+ // If vite.config.ts is compiled as CJS, then when both require('@vitejs/plugin-vue') and import('@vitejs/plugin-vue')
110
+ // are pending in the same process, Node will throw an error:
111
+ // Error [ERR_INTERNAL_ASSERTION]: Cannot require() ES Module @vitejs/plugin-vue/dist/index.js because it is not yet fully loaded.
112
+ // This may be caused by a race condition if the module is simultaneously dynamically import()-ed via Promise.all().
113
+ try {
114
+ const importVuePlugin = () => new Function('return import("@vitejs/plugin-vue")')();
115
+ await importVuePlugin();
116
+ }
117
+ catch {
118
+ // Plugin not installed or not needed, ignore
119
+ }
108
120
  const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
109
121
  const viteBuildConfig = await resolveConfig({
110
122
  configFile: absoluteConfigFilePath,