diff --git a/packages/astro/src/core/ssr/result.ts b/packages/astro/src/core/ssr/result.ts
index 7aca848a2e..5a03ab769a 100644
--- a/packages/astro/src/core/ssr/result.ts
+++ b/packages/astro/src/core/ssr/result.ts
@@ -3,6 +3,7 @@ import type { AstroConfig, AstroGlobal, AstroGlobalPartial, Params, Renderer, SS
import { bold } from 'kleur/colors';
import { canonicalURL as getCanonicalURL } from '../util.js';
import { isCSSRequest } from './css.js';
+import { isScriptRequest } from './script.js';
import { renderSlot } from '../../runtime/server/index.js';
import { warn, LogOptions } from '../logger.js';
@@ -49,6 +50,17 @@ export function createResult(args: CreateResultArgs): SSRResult {
+`;
+ } else if (isScriptRequest(path)) {
+ extra = `It looks like you are resolving scripts. If you are adding a script tag, replace with this:
+
+
+
+or consider make it a module like so:
+
+
`;
}
diff --git a/packages/astro/src/core/ssr/script.ts b/packages/astro/src/core/ssr/script.ts
new file mode 100644
index 0000000000..ec6e9ace3b
--- /dev/null
+++ b/packages/astro/src/core/ssr/script.ts
@@ -0,0 +1,8 @@
+export const SCRIPT_EXTENSIONS = new Set(['.js', '.ts']);
+
+const scriptRe = new RegExp(
+ `\\.(${Array.from(SCRIPT_EXTENSIONS)
+ .map((s) => s.slice(1))
+ .join('|')})($|\\?)`
+);
+export const isScriptRequest = (request: string): boolean => scriptRe.test(request);
\ No newline at end of file