Skip to content

feat: Adopt new vite-plugin changes#98

Draft
dawsontoth wants to merge 2 commits into
mainfrom
vite-plugin
Draft

feat: Adopt new vite-plugin changes#98
dawsontoth wants to merge 2 commits into
mainfrom
vite-plugin

Conversation

@dawsontoth
Copy link
Copy Markdown
Contributor

@dawsontoth
Copy link
Copy Markdown
Contributor Author

All the failures are expected -- I haven't published the vite-plugin for it yet, though I've tested things locally and with a beta tag.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces server-side rendering (SSR) templates for React and Vue in both JavaScript and TypeScript variants, updating framework constants, help messages, tests, and shared template scripts. It also simplifies the deployment process for existing React templates. The review feedback highlights a critical runtime issue where __dirname is used in ES modules within the Vite configurations, which should be replaced with import.meta.dirname. Additionally, the non-TypeScript React and Vue SSR templates should be cleaned up to remove accidental TypeScript references, such as logos, documentation links, and headings.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +10 to +14
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In ES modules ("type": "module"), __dirname is not defined and will throw a ReferenceError at runtime. Since this project targets Node.js 20.11.0+ (as per engines field and Node 24 .nvmrc), we should use import.meta.dirname instead of __dirname for robust path resolution, matching how it is done in the Vue templates.

Suggested change
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
resolve: {
alias: {
'@': path.resolve(import.meta.dirname, './src'),
},
},

Comment on lines +10 to +14
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In ES modules ("type": "module"), __dirname is not defined and will throw a ReferenceError at runtime. Since this project targets Node.js 20.11.0+ (as per engines field and Node 24 .nvmrc), we should use import.meta.dirname instead of __dirname for robust path resolution, matching how it is done in the Vue templates.

Suggested change
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
resolve: {
alias: {
'@': path.resolve(import.meta.dirname, './src'),
},
},

Comment on lines +1 to +35
import reactLogo from '/react.svg';
import typescriptLogo from '/typescript.svg';
import viteLogo from '/vite.svg';
import { useCallback, useState } from 'react';
import { increment } from './counter.js';

export function App() {
const [counter, setCounter] = useState(0);
const countUp = useCallback(() => {
setCounter(counter => increment(counter));
}, []);

return (
<>
<div>
<a href="https://vite.dev" target="_blank" rel="noopener noreferrer">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://www.typescriptlang.org/" target="_blank" rel="noopener noreferrer">
<img src={typescriptLogo} className="logo vanilla" alt="TypeScript logo" />
</a>
<a href="https://react.dev/" target="_blank" rel="noopener noreferrer">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
<h1>Vite + TypeScript + React</h1>
<p>Wow, look at this!</p>
<div className="card">
<button id="counter" type="button" onClick={countUp}>
count is {counter}
</button>
</div>
</div>
</>
);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This is the non-TypeScript React SSR template, but it imports the TypeScript logo, links to TypeScript documentation, and displays 'Vite + TypeScript + React' in the heading. Let's clean this up to only reference React and Vite.

import reactLogo from '/react.svg';
import viteLogo from '/vite.svg';
import { useCallback, useState } from 'react';
import { increment } from './counter.js';

export function App() {
	const [counter, setCounter] = useState(0);
	const countUp = useCallback(() => {
		setCounter(counter => increment(counter));
	}, []);

	return (
		<>
			<div>
				<a href="https://vite.dev" target="_blank" rel="noopener noreferrer">
					<img src={viteLogo} className="logo" alt="Vite logo" />
				</a>
				<a href="https://react.dev/" target="_blank" rel="noopener noreferrer">
					<img src={reactLogo} className="logo react" alt="React logo" />
				</a>
				<h1>Vite + React</h1>
				<p>Wow, look at this!</p>
				<div className="card">
					<button id="counter" type="button" onClick={countUp}>
						count is {counter}
					</button>
				</div>
			</div>
		</>
	);
}

Comment on lines +1 to +37
<script setup>
import typescriptLogo from '/typescript.svg';
import viteLogo from '/vite.svg';
import vueLogo from '/vue.svg';
import { ref } from 'vue';
import { increment } from './counter.js';

const counter = ref(0);
const countUp = () => {
counter.value = increment(counter.value);
};
</script>

<template>
<div>
<a href="https://vite.dev" target="_blank" rel="noopener noreferrer">
<img :src="viteLogo" class="logo" alt="Vite logo" />
</a>
<a
href="https://www.typescriptlang.org/"
target="_blank"
rel="noopener noreferrer"
>
<img :src="typescriptLogo" class="logo vanilla" alt="TypeScript logo" />
</a>
<a href="https://vuejs.org/" target="_blank" rel="noopener noreferrer">
<img :src="vueLogo" class="logo vue" alt="Vue logo" />
</a>
<h1>Vite + TypeScript + Vue</h1>
<p>Wow, look at this!</p>
<div class="card">
<button id="counter" type="button" @click="countUp">
count is {{ counter }}
</button>
</div>
</div>
</template>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This is the non-TypeScript Vue SSR template, but it imports the TypeScript logo, links to TypeScript documentation, and displays 'Vite + TypeScript + Vue' in the heading. Let's clean this up to only reference Vue and Vite.

<script setup>
import viteLogo from '/vite.svg';
import vueLogo from '/vue.svg';
import { ref } from 'vue';
import { increment } from './counter.js';

const counter = ref(0);
const countUp = () => {
	counter.value = increment(counter.value);
};
</script>

<template>
  <div>
    <a href="https://vite.dev" target="_blank" rel="noopener noreferrer">
      <img :src="viteLogo" class="logo" alt="Vite logo" />
    </a>
    <a href="https://vuejs.org/" target="_blank" rel="noopener noreferrer">
      <img :src="vueLogo" class="logo vue" alt="Vue logo" />
    </a>
    <h1>Vite + Vue</h1>
    <p>Wow, look at this!</p>
    <div class="card">
      <button id="counter" type="button" @click="countUp">
        count is {{ counter }}
      </button>
    </div>
  </div>
</template>

@dawsontoth dawsontoth marked this pull request as draft June 3, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant