TS8072
프런트엔드 코드 IMPORT
An import the compiler does not follow (Rule 3.9, surface §68, proposals 0022 and 0024): a path that names no file or one this compile cannot read, a file that is not a shader module, a package no node_modules holds, a subpath a package's exports does not name, a package's name alone when it has no exports, a # specifier or one that is neither relative nor a package name, a name the module does not export, and the forms a shader module has no use for (a default import or export, an import that names nothing, import(...), require, a module namespace used as a value).
레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
발생 조건
An import the compiler does not follow (Rule 3.9, surface §68, proposals 0022 and 0024): a path that names no file or one this compile cannot read, a file that is not a shader module, a package no node_modules holds, a subpath a package's exports does not name, a package's name alone when it has no exports, a # specifier or one that is neither relative nor a package name, a name the module does not export, and the forms a shader module has no use for (a default import or export, an import that names nothing, import(...), require, a module namespace used as a value). Reported on the import, and a use of the name it would have bound reports nothing more (Rule 12.4).
예제
"use typeshade"import { wave } from "./wav.shade.ts"
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, wave(uv), 1.)}빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.
TS8072 error, 2행: Cannot find the shader module "./wav.shade.ts" (looked for "wav.shade.ts").
고치는 법
같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.
"use typeshade"import { wave } from "./wave.shade.ts"
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, wave(uv), 1.)}같은 프로그램의 다른 파일에서 가져오며, compile()은 그 파일을 readDocument 옵션으로 읽습니다.
"use typeshade"
export function wave(p: vec2): f32 { return sin(p.x * 6.) * cos(p.y * 6.) * 0.5 + 0.5}이 코드가 적용하는 규칙
- 규칙 3.9 테스트
- 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.
- 규칙 12.4 테스트
- One mistake reads as one diagnostic; a refusal must not be followed by further diagnostics about the same mistake.
함께 보기
소스
커밋 26de7be8에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.