max-mapper / yo-yo

A tiny library for building modular UI components using DOM diffing and ES6 tagged template literals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hot module reload : yoyo webpack

SilentCicero opened this issue · comments

commented

Anyone have any ideas about adding hot module reload for yoyo template objects?

My current incomplete code:

//   ./yoyo-hot-loader.js
module.exports = function(source) {
  if ((source.indexOf('yo`') > -1 || source.indexOf("yo-yo") > -1) && source.indexOf("module.hot") === -1) {
    source += "if(module.hot) {";
    source += "   module.hot.accept();";
    source += "}";

    return source;
  }

  return null;
}

I'm not to familiar with the webpack hot reload plugin. Currently, this does hot reload but does not remove the old code. Ideas?

Here is the API: https://webpack.github.io/docs/hot-module-replacement.html

commented

cc/ @shama - I reckon you might be the bestest person of us all to solve this, hah ✨ - I have no idea how to webpack

commented

@yoshuawuyts lolol. Oh god. Well it is a mess of a system, but powerful.

Really like yoyo, want to build with it. I have big plans for these little modules. And sheet-router is awesome =D

commented

This seems of use as well @shama https://github.com/just-boris/handlebars-hot-loader - fairly simple

I haven't used yo-yo or bel with webpack yet but it should just work. When I get some time I'll play around with it a bit.