Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Jul 31, 2023
1 parent c344d7d commit 7ec274a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/astro/src/vite-plugin-scanner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export interface AstroPluginScannerOptions {
logging: LogOptions;
}

const KNOWN_FILE_EXTENSIONS = ['.astro', '.js', '.ts'];

export default function astroScannerPlugin({
settings,
logging,
Expand Down Expand Up @@ -44,15 +46,13 @@ export default function astroScannerPlugin({
if (typeof pageOptions.prerender === 'undefined') {
pageOptions.prerender = defaultPrerender;
}
const fileExtension = extname(filename);

// `getStaticPaths` warning is just a string check, should be good enough for most cases
if (
!pageOptions.prerender &&
isServerLikeOutput(settings.config) &&
code.includes('getStaticPaths') &&
// this should only be valid for `.astro` files
fileExtension === '.astro'
// this should only be valid for `.astro`, `.js` and `.ts` files
KNOWN_FILE_EXTENSIONS.includes(extname(filename))
) {
const reason = ` because \`output: "${settings.config.output}"\` is set`;
warn(
Expand Down

0 comments on commit 7ec274a

Please sign in to comment.