This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +35
-20
lines changed Expand file tree Collapse file tree 4 files changed +35
-20
lines changed Original file line number Diff line number Diff line change 1
- import sass from '../../plugins/sass.ts'
2
- import wasm from '../../plugins/wasm.ts'
1
+ import wasm from './wasm_loader.ts'
3
2
import type { Config } from '../../types.ts'
4
3
5
4
export default ( ) : Config => ( {
6
- plugins : [ sass ( ) , wasm ( ) ]
5
+ plugins : [ wasm ( ) ]
7
6
} )
Original file line number Diff line number Diff line change @@ -2,11 +2,26 @@ import React from 'react'
2
2
// @ts -expect-error
3
3
import wasm from '../lib/42.wasm'
4
4
5
+ const fontSize = 240
6
+
5
7
export default function Home ( ) {
6
8
return (
7
- < >
8
- < link rel = "stylesheet" href = "../style/style.scss" />
9
+ < main >
10
+ < style > { `
11
+ body {
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ width: 100vw;
16
+ height: 100vh;
17
+ overflow: hidden;
18
+ }
19
+
20
+ h1 {
21
+ font-size: ${ fontSize } px;
22
+ }
23
+ ` } </ style >
9
24
< h1 > { wasm . main ( ) } </ h1 >
10
- </ >
25
+ </ main >
11
26
)
12
27
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import type { LoaderPlugin } from '../../types.ts'
2
+
3
+ export default ( ) : LoaderPlugin => ( {
4
+ name : 'wasm-loader' ,
5
+ type : 'loader' ,
6
+ test : / \. w a s m $ / i,
7
+ transform : ( { content } ) => ( {
8
+ code : [
9
+ `const wasmBytes = new Uint8Array([${ content . join ( ',' ) } ])` ,
10
+ 'const wasmModule = new WebAssembly.Module(wasmBytes)' ,
11
+ 'const { exports } = new WebAssembly.Instance(wasmModule)' ,
12
+ 'export default exports' ,
13
+ ] . join ( '\n' )
14
+ } )
15
+ } )
You can’t perform that action at this time.
0 commit comments