add preact with webpack

This commit is contained in:
Thomas Ruoff
2017-02-15 00:46:54 +01:00
parent 316d05790b
commit 7668fc3837
15 changed files with 229 additions and 3 deletions

19
webapp/index.js Normal file
View File

@@ -0,0 +1,19 @@
import { render } from 'preact';
function init() {
const App = require('./views').default;
render(App, document.getElementById('root'), document.getElementById('app'));
}
init();
if (process.env.NODE_ENV === 'production') {
console.log('for real now');
} else {
// use preact's devtools
require('preact/devtools');
// listen for HMR
if (module.hot) {
module.hot.accept('./views', init);
}
}