TS8072
On this page

TS8072

Front-end code IMPORT

An import that the compiler does not follow (Rule 3.9): a path that names no file or one that this compile cannot read, a file that is not a shader module, a package that no node_modules holds, a subpath that a package's exports does not name, a name that the module does not export, or a form that a shader module has no use for (a default import or export, an import that names nothing, import(...), require).

The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.

The registry text and every compiler message on these pages are the compiler's own English.

Example

example.shade.ts
"use typeshade"
import { wave } from "./wav.shade.ts"
@fragment
export function main(uv: location<0, vec2>): vec4 {
return vec4(uv, wave(uv), 1.)
}

Compiled at build time against the pinned compiler, this program gets:

TS8072 error, line 2: Cannot find the shader module "./wav.shade.ts" (looked for "wav.shade.ts").

How to fix it

The same program, corrected. It compiles with no diagnostic.

example.shade.ts
"use typeshade"
import { wave } from "./wave.shade.ts"
@fragment
export function main(uv: location<0, vec2>): vec4 {
return vec4(uv, wave(uv), 1.)
}

It imports from another file of the same program, which compile() reads through its readDocument option:

wave.shade.ts
"use typeshade"
export function wave(p: vec2): f32 {
return sin(p.x * 6.) * cos(p.y * 6.) * 0.5 + 0.5
}

The rule this enforces

Rule 3.9 Test
A shader file may import what another shader file exports, by a relative specifier or, from a package, by the package’s name; the file a compile starts from and every shader file it imports, directly or through another, are one program, which emits one module, and each file keeps the scope TypeScript gives it.

See also

Source

Where the compiler raises this code at commit af54ddad5, one line per file:

Edit this page Report a problem