enable legacy babel5 module interop for compiler

pull/98/head
dperolio 2 years ago
parent 1daa518b35
commit 971bdfa31b
No known key found for this signature in database
GPG Key ID: 4191689562D51409

@ -68,8 +68,8 @@ electron.protocol.registerSchemesAsPrivileged([
electron.app.once('ready', () => {
if (reactDeveloperTools) {
installExtension(REACT_DEVELOPER_TOOLS)
.then(name => console.log(`Added Extension: ${name}`))
.catch(err => console.error('An error occurred: ', err));
.then(name => console.log(`Added Extension: ${name}`))
.catch(err => console.error(`An error occurred: ${err}`));
}
/**
* @todo Possibly add whitelists instead of just disabling CSP.

@ -75,7 +75,7 @@ require('./renderer');
/**
* Instantiate Vizality.
*/
const Vizality = require('../renderer/src').default;
const Vizality = require('../renderer/src');
window.vizality = new Vizality();
/**

@ -75,7 +75,7 @@ const WHITELISTED_MODULES = [
if (window && !window.__SPLASH__) {
window.require = module => {
try {
if (WHITELISTED_MODULES.includes(module) || module.startsWith('@vizality')) {
if (WHITELISTED_MODULES.includes(module) || module.startsWith('@vizality') || module.startsWith('@discord')) {
return require(module);
}
throw new Error(`Node module "${module.toString()}" is not whitelisted and cannot be used in this scope.`);

@ -12,6 +12,7 @@ module.exports = class JS extends Compiler {
const js = readFileSync(this.file, 'utf8');
return sucrase.transform(js, {
transforms: [ 'jsx', 'imports' ],
enableLegacyBabel5ModuleInterop: true,
filePath: this.file
}).code;
}

@ -12,6 +12,7 @@ module.exports = class JSX extends Compiler {
const jsx = readFileSync(this.file, 'utf8');
return sucrase.transform(jsx, {
transforms: [ 'jsx', 'imports' ],
enableLegacyBabel5ModuleInterop: true,
filePath: this.file
}).code;
}

@ -12,6 +12,7 @@ module.exports = class TS extends Compiler {
const ts = readFileSync(this.file, 'utf8');
return sucrase.transform(ts, {
transforms: [ 'jsx', 'imports', 'typescript' ],
enableLegacyBabel5ModuleInterop: true,
filePath: this.file
}).code;
}

@ -12,6 +12,7 @@ module.exports = class TSX extends Compiler {
const tsx = readFileSync(this.file, 'utf8');
return sucrase.transform(tsx, {
transforms: [ 'jsx', 'imports', 'typescript' ],
enableLegacyBabel5ModuleInterop: true,
filePath: this.file
}).code;
}

Loading…
Cancel
Save