Commit 31e278e6 authored by Romain Casati's avatar Romain Casati
Browse files

Fix: conflict with requirejs in SQL kernel loading.

parent 13a62de5
......@@ -16,13 +16,27 @@
constructor() {
super();
this.execution_count = 0;
this._sqlJsUrl = "https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.5.0/sql-wasm.min.js";
};
language () { return "sql"; };
languageName () { return "SQL"; };
async launch () {
await this.loadScript("https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.5.0/sql-wasm.min.js");
// avoid conflict with requirejs and use it when available.
try {
if( typeof requirejs !== 'undefined' ) {
requirejs.config({paths: {'sql-wasm': this._sqlJsUrl.slice(0, -3)}});
await new Promise(function (resolve, reject) {
require(['sql-wasm'], resolve, reject);
});
} else {
await this.loadScript(this._sqlJsUrl);
}
} catch (error) {
console.log(error);
console.error("Can't load sql.js");
}
const SQL = await window.initSqlJs({
locateFile: file => `https://sql.js.org/dist/${file}`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment