-
-
Save jxnblk/3abb310c1c5e0803592eac6e4cf35148 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/bunnies.examples.js b/src/bunnies.examples.js | |
index f8a9f55..e03c5b3 100644 | |
--- a/src/bunnies.examples.js | |
+++ b/src/bunnies.examples.js | |
@@ -1,3 +1,3 @@ | |
import {bunnies} from './bunnies' | |
-export const capitalBunnies = bunnies.map(b => b.toUpperCase()) | |
+export const capitalBunnies = bunnies.map(b => 'hello, ' + b.toUpperCase()) | |
diff --git a/src/index.js b/src/index.js | |
index 7b09172..e7eb260 100644 | |
--- a/src/index.js | |
+++ b/src/index.js | |
@@ -1,10 +1,11 @@ | |
const context = require.context('.', true, /\/.*\.examples\.js/) | |
-console.log(context.keys()) | |
+console.log(context.keys(), context.id) | |
const root = document.getElementById('root') | |
function renderThings() { | |
+ console.log('renderThings') | |
const allThings = context.keys().map(path => context(path)) | |
root.innerHTML = `<pre>${JSON.stringify(allThings, null, 2)}</pre>` | |
} | |
@@ -13,8 +14,9 @@ renderThings() | |
if (module.hot) { | |
// what I want to be able to do: | |
- module.hot.accept(context.keys(), () => { | |
+ module.hot.accept(context.id, () => { | |
// this is never called | |
+ console.log('hot') | |
renderThings() | |
}) | |
// I've also tried | |
@@ -22,10 +24,10 @@ if (module.hot) { | |
// module.hot.accept(context.id, () => {}) | |
// not even this works. | |
- module.hot.accept('./bats.examples.js', () => { | |
- // this is never called | |
- console.log('bats!') | |
- }) | |
+ // module.hot.accept('./bats.examples.js', () => { | |
+ // // this is never called | |
+ // console.log('bats!') | |
+ // }) | |
// These don't work. I get a full page refresh with a warning that the changed | |
// file is not accepted and a gnarly error like: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment