Skip to content

Commit 9f5c93c

Browse files
committed
Fix: node.js hacks for components and prism.js
1 parent fd54995 commit 9f5c93c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

components/prism-core.js

+5
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,8 @@ return _self.Prism;
426426
if (typeof module !== 'undefined' && module.exports) {
427427
module.exports = Prism;
428428
}
429+
430+
// hack for components to work correctly in node.js
431+
if (typeof global !== 'undefined') {
432+
global.Prism = Prism;
433+
}

plugins/file-highlight/prism-file-highlight.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function () {
2-
if (!self.Prism || !self.document || !document.querySelector) {
2+
if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {
33
return;
44
}
55

0 commit comments

Comments
 (0)