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

Issues when rendering strings (TypeError: Cannot read property 'appendChild$' of undefined) #1

Open
aalemayhu opened this issue May 13, 2021 · 0 comments

Comments

@aalemayhu
Copy link
Member

Using this repository running the below script to produce HTML for the use-case where you would want to produce a static file for deployment. Reproducer and error message below. I was expecting it to print out a long line of HTML, which does work if <App> is removed.

# build_html.imba
import {App} from './app'

let html = <html>
	<head>
		<title> "Application"
	<body>
		<script type='module' src='./app'>
		<App>

console.log(String(html))

Error Output

(base) ➜  ssr-app-imba git:(main) ✗ npx imba --version
2.0.0-alpha.133
(base) ➜  ssr-app-imba git:(main) ✗ npx imba src/build_html.imba
cache dir does not exist - create /Users/scanf/src/github.com/alemayhu/ssr-app-imba/node_modules/imba/.imba-cache
TypeError: Cannot read property 'appendChild$' of undefined
    at App.insertInto$ (/Users/scanf/src/github.com/alemayhu/ssr-app-imba/src/build_html.imba:1204:12)
        -> /Users/scanf/src/github.com/alemayhu/ssr-app-imba/node_modules/imba/src/imba/dom/core.imba:311:10
    at Object.<anonymous> (/Users/scanf/src/github.com/alemayhu/ssr-app-imba/src/build_html.imba:3396:498)
        -> /Users/scanf/src/github.com/alemayhu/ssr-app-imba/src/build_html.imba:8:4
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.import_module.Module._extensions.<computed> (/Users/scanf/src/github.com/alemayhu/ssr-app-imba/node_modules/imba/loader.imba.js:316:16)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:763:16)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

Commenting out

<!-- (base) ➜  ssr-app-imba git:(main) ✗ npx imba src/build_html.imba -->
<!DOCTYPE html><html class="a-b"><head class="a-c"><title class="a-d">Application</title>
<link rel='stylesheet' href='/__assets__/src/app.Z14AEOKZ.css'>
</head><body class="a-e"><script class="a-f" type="module" src="/__assets__/src/app.OS5SUIKO.js"></script></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant