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'
32import type { Config } from '../../types.ts'
43
54export default ( ) : Config => ( {
6- plugins : [ sass ( ) , wasm ( ) ]
5+ plugins : [ wasm ( ) ]
76} )
Original file line number Diff line number Diff line change @@ -2,11 +2,26 @@ import React from 'react'
22// @ts -expect-error
33import wasm from '../lib/42.wasm'
44
5+ const fontSize = 240
6+
57export default function Home ( ) {
68 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 >
924 < h1 > { wasm . main ( ) } </ h1 >
10- </ >
25+ </ main >
1126 )
1227}
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