diff --git a/components/prism-core.js b/components/prism-core.js index 6b5799350b..d59b09e5a7 100644 --- a/components/prism-core.js +++ b/components/prism-core.js @@ -426,3 +426,8 @@ return _self.Prism; if (typeof module !== 'undefined' && module.exports) { module.exports = Prism; } + +// hack for components to work correctly in node.js +if (typeof global !== 'undefined') { + global.Prism = Prism; +} diff --git a/plugins/file-highlight/prism-file-highlight.js b/plugins/file-highlight/prism-file-highlight.js index 1a49254f27..6a2a540635 100644 --- a/plugins/file-highlight/prism-file-highlight.js +++ b/plugins/file-highlight/prism-file-highlight.js @@ -1,5 +1,5 @@ (function () { - if (!self.Prism || !self.document || !document.querySelector) { + if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) { return; }