astro-ui icon indicating copy to clipboard operation
astro-ui copied to clipboard

Unknown file extension ".astro"

Open chuygil opened this issue 3 years ago • 3 comments
trafficstars

Using Font component in astro v0.23.0-next.10.

While dev server is running, I installed astro-fonts and placed this in my BaseHead.astro component:

---
import { Font } from 'astro-fonts';

export interface Props {
    title: string;
}

const { title } = Astro.props as Props;
---


<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link rel="icon" type="image/x-icon" href="/favicon.ico" />

<Font family="Inter" weights={[400, 600]} local />
<Font family="JetBrains Mono" weights="400" local />


<title>{title}</title>

After I save, I can see the fonts directory being made with the .woff2 fonts files and .css files. I can see the font working now, but if I restart the dev server I get the following error:

Unknown file extension ".astro" for /home/chuy/projects/jesusgil.dev/node_modules/astro-fonts/Fonts.astro
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".astro" for /home/chuy/projects/jesusgil.dev/node_modules/astro-fonts/Fonts.astro
    at new NodeError (node:internal/errors:371:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:87:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:102:38)
    at defaultLoad (node:internal/modules/esm/load:21:14)
    at ESMLoader.load (node:internal/modules/esm/loader:359:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
    at new ModuleJob (node:internal/modules/esm/module_job:66:26)
    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:81:21)

This is the output I see in dev server:

[vite] Error when evaluating SSR module /src/components/BaseHead.astro:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".astro" for /home/chuy/projects/jesusgil.dev/node_modules/astro-fonts/Fonts.astro
    at new NodeError (node:internal/errors:371:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:87:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:102:38)
    at defaultLoad (node:internal/modules/esm/load:21:14)
    at ESMLoader.load (node:internal/modules/esm/loader:359:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
    at new ModuleJob (node:internal/modules/esm/module_job:66:26)
    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:81:21)
11:32:53 AM [vite] Error when evaluating SSR module /src/layouts/Page.astro:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".astro" for /home/chuy/projects/jesusgil.dev/node_modules/astro-fonts/Fonts.astro
    at new NodeError (node:internal/errors:371:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:87:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:102:38)
    at defaultLoad (node:internal/modules/esm/load:21:14)
    at ESMLoader.load (node:internal/modules/esm/loader:359:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
    at new ModuleJob (node:internal/modules/esm/module_job:66:26)
    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:81:21)

chuygil avatar Feb 18 '22 17:02 chuygil

dafaq... Ill look into this dude, can you revert back to v0.1 for the time being if possible, and why do folk always want to use the @next branch 😅

aFuzzyBear avatar Feb 18 '22 17:02 aFuzzyBear

Will do. We like to live on the edge, life is short lol

chuygil avatar Feb 18 '22 17:02 chuygil

aye if you are an america, where as life is generally quite long and enjoyed, its how us bears roll, if the ice isnt stable dont go on it... 🐻‍❄️

aFuzzyBear avatar Feb 18 '22 17:02 aFuzzyBear