Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 7c67020

Browse files
committed
fix(plugins): fix loader output
1 parent d2039bd commit 7c67020

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

plugins/css.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export type Options = {
1717
}
1818

1919
export default (options?: Options): LoaderPlugin => {
20-
const encoder = new TextEncoder()
21-
2220
let pcssProcessor: any = null
2321
let cleanCSS: any = null
2422
let isProd: any = null
@@ -49,10 +47,10 @@ export default (options?: Options): LoaderPlugin => {
4947
}
5048
}
5149
return {
52-
code: encoder.encode([
50+
code: [
5351
'import { applyCSS } from "https://deno.land/x/aleph/framework/core/style.ts"',
5452
`applyCSS(${JSON.stringify(url)}, ${JSON.stringify(css)})`
55-
].join('\n'))
53+
].join('\n')
5654
// todo: generate map
5755
}
5856
}

plugins/sass.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export default (opts?: Options): LoaderPlugin => {
2828
sourceMap: true
2929
})
3030
return {
31-
code: css,
31+
code: decoder.decode(css),
3232
type: 'css',
33-
map: map,
33+
map: map ? decoder.decode(map) : undefined,
3434
}
3535
}
3636
}

plugins/wasm.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ export default (): LoaderPlugin => ({
44
name: 'wasm-loader',
55
type: 'loader',
66
test: /\.wasm$/i,
7-
transform: ({ content }) => {
8-
const encoder = new TextEncoder()
9-
return {
10-
code: encoder.encode([
11-
`const wasmBytes = new Uint8Array([${content.join(',')}])`,
12-
'const wasmModule = new WebAssembly.Module(wasmBytes)',
13-
'const { exports } = new WebAssembly.Instance(wasmModule)',
14-
'export default exports',
15-
].join('\n'))
16-
}
17-
}
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+
})
1815
})

server/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,7 @@ export class Application implements ServerApplication {
10551055
}
10561056

10571057
const t = performance.now()
1058+
console.log('-', url, source.type)
10581059
const { code, deps, starExports, map } = await transform(url, source.code, {
10591060
...this.defaultCompileOptions,
10601061
swcOptions: {

0 commit comments

Comments
 (0)