Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 448e313

Browse files
committed
Fix: Correct wavedrom import to avoid missing node modules.
1 parent 85362b1 commit 448e313

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

runestone/wavedrom/js/wavedrom.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// ***********************************************
22
// |docname| - JavaScript for the WaveDrom library
33
// ***********************************************
4-
'use strict';
4+
"use strict";
55

66
// This took a fair amount of experimenting to figure out how to make this work with NPM and Webpack. Sigh. Here's the working result.
77
//
8-
// All we need is the ability to call the default export of ``ProcessAll`` in order to render timing diagrams.
9-
import ProcessAll from "wavedrom/lib/process-all.js";
8+
// This has already been packaged for the web with browserify, so we can just import it for the side effects (it defines ``window.WaveDrom``. Importing from the ``lib/`` folder produces a lot of unsatisfied imports when using webpack.
9+
import "wavedrom/wavedrom.min.js";
1010

11-
// WaveSkin isn't defined globally, so import the default export to get access to it.
12-
import WaveSkin from "wavedrom/lib/wave-skin.js";
13-
// Make the required WaveSkin (needed by WaveDrom) available globally.
11+
// WaveSkin isn't defined globally, so import the default export to get access to it. It defines a single variable, assuming that the variable will be assigned to the ``window``. Here, it's not. So...
12+
import WaveSkin from "wavedrom/skins/default.js";
13+
// ...make the required WaveSkin (needed by WaveDrom) available globally.
1414
window.WaveSkin = WaveSkin;
1515

1616
// Run the render after the dynamic load is done.
17-
$(document).on("runestone:login-complete", ProcessAll);
17+
$(document).on("runestone:login-complete", window.WaveDrom.ProcessAll);

webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ module.exports = (env, argv) => {
4848
crypto: false,
4949
fs: false,
5050
path: false,
51-
string_decoder: false,
5251
},
5352
},
5453
externals: {

0 commit comments

Comments
 (0)