Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add module types #10299

Merged
merged 4 commits into from
Oct 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 38 additions & 11 deletions packages/vite/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ declare module '*.module.pcss' {
const classes: CSSModuleClasses
export default classes
}
declare module '*.module.sss' {
const classes: CSSModuleClasses
export default classes
}

// CSS
declare module '*.css' {
Expand Down Expand Up @@ -61,11 +65,19 @@ declare module '*.pcss' {
const css: string
export default css
}
declare module '*.sss' {
const css: string
export default css
}

// Built-in asset types
// see `src/constants.ts`
// see `src/node/constants.ts`

// images
declare module '*.png' {
const src: string
export default src
}
declare module '*.jpg' {
const src: string
export default src
Expand All @@ -86,10 +98,6 @@ declare module '*.pjp' {
const src: string
export default src
}
declare module '*.png' {
const src: string
export default src
}
declare module '*.gif' {
const src: string
export default src
Expand Down Expand Up @@ -164,12 +172,6 @@ declare module '*.otf' {
}

// other
declare module '*.wasm?init' {
const initWasm: (
options: WebAssembly.Imports
) => Promise<WebAssembly.Instance>
export default initWasm
}
declare module '*.webmanifest' {
const src: string
export default src
Expand All @@ -183,6 +185,14 @@ declare module '*.txt' {
export default src
}

// wasm?init
declare module '*.wasm?init' {
const initWasm: (
options: WebAssembly.Imports
) => Promise<WebAssembly.Instance>
export default initWasm
}

// web worker
declare module '*?worker' {
const workerConstructor: {
Expand All @@ -198,13 +208,30 @@ declare module '*?worker&inline' {
export default workerConstructor
}

declare module '*?worker&url' {
const src: string
export default src
}

declare module '*?sharedworker' {
sapphi-red marked this conversation as resolved.
Show resolved Hide resolved
const sharedWorkerConstructor: {
new (): SharedWorker
}
export default sharedWorkerConstructor
}

declare module '*?sharedworker&inline' {
const sharedWorkerConstructor: {
new (): SharedWorker
}
export default sharedWorkerConstructor
}

declare module '*?sharedworker&url' {
const src: string
export default src
}

declare module '*?raw' {
const src: string
export default src
Expand Down