@nx/vite 23.3.0-beta.1 → 23.3.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.
@@ -95,24 +95,12 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
95
95
  catch {
96
96
  // do nothing
97
97
  }
98
- // Workaround for race condition with ESM-only Vite plugins (e.g. @vitejs/plugin-vue@6+)
99
- // If vite.config.ts is compiled as CJS, then when both require('@vitejs/plugin-vue') and import('@vitejs/plugin-vue')
100
- // are pending in the same process, Node will throw an error:
101
- // Error [ERR_INTERNAL_ASSERTION]: Cannot require() ES Module @vitejs/plugin-vue/dist/index.js because it is not yet fully loaded.
102
- // This may be caused by a race condition if the module is simultaneously dynamically import()-ed via Promise.all().
103
- try {
104
- const importVuePlugin = () => new Function('return import("@vitejs/plugin-vue")')();
105
- await importVuePlugin();
106
- }
107
- catch {
108
- // Plugin not installed or not needed, ignore
109
- }
110
98
  const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
111
- const viteBuildConfig = await resolveConfig({
99
+ const viteBuildConfig = await (0, internal_1.retryOnRequireEsmRace)(() => resolveConfig({
112
100
  configFile: absoluteConfigFilePath,
113
101
  mode: 'development',
114
102
  root: projectRoot,
115
- }, 'build');
103
+ }, 'build'));
116
104
  const metadata = {};
117
105
  const { buildOutputs, isBuildable, hasServeConfig } = getOutputs(viteBuildConfig, projectRoot, context.workspaceRoot);
118
106
  const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
@@ -2,12 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureDependencies = ensureDependencies;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const internal_1 = require("@nx/js/internal");
5
6
  const semver_1 = require("semver");
6
7
  const versions_1 = require("./versions");
7
8
  function ensureDependencies(host, schema) {
8
9
  const devDependencies = {};
9
10
  if (schema.uiFramework === 'react') {
10
11
  if (schema.compiler === 'swc') {
12
+ // @vitejs/plugin-react-swc depends on @swc/core.
13
+ (0, internal_1.acknowledgeSwcBuildScripts)(host);
11
14
  devDependencies['@vitejs/plugin-react-swc'] = versions_1.vitePluginReactSwcVersion;
12
15
  }
13
16
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/vite",
3
- "version": "23.3.0-beta.1",
3
+ "version": "23.3.0-beta.3",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -100,13 +100,13 @@
100
100
  "semver": "^7.6.3",
101
101
  "tslib": "^2.3.0",
102
102
  "ajv": "^8.0.0",
103
- "@nx/devkit": "23.3.0-beta.1",
104
- "@nx/js": "23.3.0-beta.1",
105
- "@nx/vitest": "23.3.0-beta.1"
103
+ "@nx/devkit": "23.3.0-beta.3",
104
+ "@nx/js": "23.3.0-beta.3",
105
+ "@nx/vitest": "23.3.0-beta.3"
106
106
  },
107
107
  "devDependencies": {
108
- "@nx/eslint": "23.3.0-beta.1",
109
- "nx": "23.3.0-beta.1"
108
+ "@nx/eslint": "23.3.0-beta.3",
109
+ "nx": "23.3.0-beta.3"
110
110
  },
111
111
  "peerDependencies": {
112
112
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"