mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Fix DOMParser in node.js
This commit is contained in:
parent
9c1e8588ba
commit
b935dd8613
2 changed files with 10 additions and 0 deletions
|
@ -1586,6 +1586,11 @@ delete this.BLOCKLY_DIR;
|
|||
delete this.BLOCKLY_BOOT;
|
||||
};
|
||||
|
||||
if (typeof DOMParser == 'undefined' && typeof require == 'function') {
|
||||
// Node.js needs DOMParser loaded separately.
|
||||
var DOMParser = require('xmldom').DOMParser;
|
||||
}
|
||||
|
||||
// Delete any existing Closure (e.g. Soy's nogoog_shim).
|
||||
document.write('<script>var goog = undefined;</script>');
|
||||
// Load fresh Closure Library.
|
||||
|
|
5
build.py
5
build.py
|
@ -132,6 +132,11 @@ delete this.BLOCKLY_DIR;
|
|||
delete this.BLOCKLY_BOOT;
|
||||
};
|
||||
|
||||
if (typeof DOMParser == 'undefined' && typeof require == 'function') {
|
||||
// Node.js needs DOMParser loaded separately.
|
||||
var DOMParser = require('xmldom').DOMParser;
|
||||
}
|
||||
|
||||
// Delete any existing Closure (e.g. Soy's nogoog_shim).
|
||||
document.write('<script>var goog = undefined;</script>');
|
||||
// Load fresh Closure Library.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue