@@ -31,6 +31,7 @@ function wasmJsResolver() {
31
31
// Function sends back the code, sample usage code and stats
32
32
export async function buildBundle ( requestedImports , format ) {
33
33
const { bundleSource, bundleComments, usage } = getBundleSource ( requestedImports , format )
34
+ console . log ( 'BUNDLE SOURCE' , bundleSource )
34
35
await esbuildInitPromise
35
36
const params = {
36
37
stdin : {
@@ -87,7 +88,7 @@ function getBundleSource(requestedImports, format) {
87
88
}
88
89
}
89
90
let usageByFormat = ''
90
- const withSignals = requestedImports [ '@preact/signals' ] ? true : false
91
+ const withSignals = requestedImports [ '@preact/signals' ] && requestedImports [ '@preact/signals' ] . includes ( 'signal' )
91
92
const withUseState = requestedImports [ 'preact/hooks' ] && requestedImports [ 'preact/hooks' ] . includes ( 'useState' )
92
93
if ( format === 'esm' ) {
93
94
bundleSource += `export { ${ bundleExports . join ( ', ' ) } };\n`
@@ -160,13 +161,12 @@ function getAppUsageWithHtm(withSignals, withUseState,) {
160
161
]
161
162
}
162
163
return [
163
- ' const html = htm.bind(h)' ,
164
164
'' ,
165
165
' function App(props) {' ,
166
166
' return html`<h1>Hello ${props.name}!</h1>`' ,
167
167
' }' ,
168
168
'' ,
169
- ' render(html`<${App} name="World" />`, document.querySelector(\'. root\'))' ,
169
+ ' render(html`<${App} name="World" />`, document.querySelector(\'# root\'))' ,
170
170
]
171
171
172
172
}
@@ -176,7 +176,7 @@ function getAppUsageWithoutHtm() {
176
176
' function App(props) {' ,
177
177
' return h(\'h1\', null, `Hello ${props.name}!`)' ,
178
178
' }' ,
179
- ' render(App({ name: \'World\' }), document.querySelector(\'. root\'))' ,
179
+ ' render(App({ name: \'World\' }), document.querySelector(\'# root\'))' ,
180
180
]
181
181
}
182
182
0 commit comments