question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bankai Build with yo-yo/bel

See original GitHub issue

I may be missing something fundamental here, so please bear with me.

Is it possible to use the bankai build command to compile a file that uses something lower level than choo, like yo-yo/bel or even just the browser’s DOM API. Even without checking for window, choo apps compile fine for me with bankai build, but nothing else seems to work as I’d expect it to.

For example, the following example renders properly when using bankai start and compiles without errors using bankai build, but does not render when served over a static server.

var html = require('yo-yo');

var $header = function() {
	return html` <header>
		<nav class="navbar">
			<a href="/" onclick=${linkHandler}>Home</a>
			<a href="/about" onclick=${linkHandler}>About</a>
		</nav>
	</header>`;

	function linkHandler(e) {
		e.preventDefault();
		console.log('link clicked', e.target.href);
		router.emit(e.target.href);
	}
};

if (typeof window !== 'undefined' && !module.parent) {
	window.addEventListener('load', function() {
		document.body.appendChild($header());
	});
}

Similarly, using the DOM API doesn’t seem to work either.

if(type window !== 'undefiend' && !module.parent){
  var el = document.creatElement('h1');
  el.textContent = 'Hello World';
  document.body.appendChild(el);
}

Am I missing a transform or something? I know there has to be something I’m just not understanding properly about the way Bankai is supposed to work. Any information to help point me in the right direction would be greatly appreciated.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
earthtonecommented, Feb 6, 2018

This did the trick! Thanks.

How common/uncommon are cyclical dependencies? It was quick hack on my part just to separate functionality into separate files to make things easier on me, but is it something that’s generally advised against?

0reactions
goto-bus-stopcommented, Feb 7, 2018

Imo avoiding cyclical dependencies makes it easier to think about the order in which modules are executed; with cyclical require() calls you can get access to a module that has only executed half of its code, which can be confusing. Sometimes they are necessary tho so it’s not a strict rule.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shunsui TYBW Resurrection T20 Showcase! Best Build PVE ...
Shunsui TYBW Resurrection T20 Showcase! Best Build PVE! Kyoraku Bankai Bleach Brave Souls ブレソル. Watch later. Share. Copy link.
Read more >
RETSU BANKAI 3/5 PVP SHOWCASE! T20 BEST BUILD FOR ...
Bleach Brave Souls RETSU BANKAI 3/5 PVP SHOWCASE! Remember to Subscribe the Channel & Smash the Like Button If u Enjoy!...
Read more >
Shinobi Striker| *NEW* Tosen Bleach Cac Build ... - YouTube
Today we are making a Tosen Cac Build From Bleach this is one of my ... Shinobi Striker| *NEW* Tosen Bleach Cac Build...
Read more >
BEST TECH UNIT! TYBW North/West Bankai Yamamoto 10/10 ...
TYBW North/West Bankai Yamamoto 10/10/10 Showcase (SAR/SAD Builds ) Brave Souls. Watch later. Share. Copy link. Info. Shopping. Tap to unmute.
Read more >
Bleach Brave Souls: TYBW True Bankai Ichigo 10 ... - YouTube
Bleach Brave Souls: TYBW True Bankai Ichigo 10/10/10 Showcase (NAD/SAD/SAR Builds ). 3.4K views 3 years ago. DeathSmasher. DeathSmasher.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found