@vitejs/plugin-react 2.0.1 → 2.1.0-beta.0

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/dist/index.cjs CHANGED
@@ -431,7 +431,7 @@ function viteReact(opts = {}) {
431
431
  config() {
432
432
  return {
433
433
  optimizeDeps: {
434
- include: [reactJsxRuntimeId, reactJsxDevRuntimeId]
434
+ include: [reactJsxRuntimeId, reactJsxDevRuntimeId, "react"]
435
435
  }
436
436
  };
437
437
  },
package/dist/index.mjs CHANGED
@@ -410,7 +410,7 @@ function viteReact(opts = {}) {
410
410
  config() {
411
411
  return {
412
412
  optimizeDeps: {
413
- include: [reactJsxRuntimeId, reactJsxDevRuntimeId]
413
+ include: [reactJsxRuntimeId, reactJsxDevRuntimeId, "react"]
414
414
  }
415
415
  };
416
416
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-react",
3
- "version": "2.0.1",
3
+ "version": "2.1.0-beta.0",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "contributors": [
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-react#readme",
41
41
  "dependencies": {
42
- "@babel/core": "^7.18.10",
42
+ "@babel/core": "^7.18.13",
43
43
  "@babel/plugin-transform-react-jsx": "^7.18.10",
44
44
  "@babel/plugin-transform-react-jsx-development": "^7.18.6",
45
45
  "@babel/plugin-transform-react-jsx-self": "^7.18.6",
package/src/index.ts CHANGED
@@ -406,7 +406,10 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
406
406
  config() {
407
407
  return {
408
408
  optimizeDeps: {
409
- include: [reactJsxRuntimeId, reactJsxDevRuntimeId]
409
+ // We can't add `react-dom` because the dependency is `react-dom/client`
410
+ // for React 18 while it's `react-dom` for React 17. We'd need to detect
411
+ // what React version the user has installed.
412
+ include: [reactJsxRuntimeId, reactJsxDevRuntimeId, 'react']
410
413
  }
411
414
  }
412
415
  },
@@ -76,7 +76,7 @@ export default function (
76
76
 
77
77
  /**
78
78
  * Get a JSXIdentifier or JSXMemberExpression from a Node of known type.
79
- * Returns null if a unknown node type, null or undefined is passed.
79
+ * Returns null if an unknown node type, null or undefined is passed.
80
80
  */
81
81
  function getJSXName(node: any): any {
82
82
  if (node == null) {
@@ -100,7 +100,7 @@ export default function (
100
100
  }
101
101
 
102
102
  /**
103
- * Get a array of JSX(Spread)Attribute from a props ObjectExpression.
103
+ * Get an array of JSX(Spread)Attribute from a props ObjectExpression.
104
104
  * Handles the _extends Expression babel creates from SpreadElement nodes.
105
105
  * Returns null if a validation error occurs.
106
106
  */