1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-30 23:44:55 +02:00

Mobile: Fixed mobile build

This commit is contained in:
Laurent Cozic
2021-01-27 17:42:58 +00:00
parent 35597ce3c2
commit 12187b9da3
24 changed files with 1247 additions and 79 deletions

View File

@ -4,7 +4,7 @@ import Joplin from './Joplin';
/**
* @ignore
*/
const builtinModules = require('builtin-modules');
// const builtinModules = require('builtin-modules');
/**
* @ignore
@ -12,7 +12,7 @@ const builtinModules = require('builtin-modules');
export default class Global {
private joplin_: Joplin;
private requireWhiteList_: string[] = null;
// private requireWhiteList_: string[] = null;
// private consoleWrapper_:any = null;
constructor(implementation: any, plugin: Plugin, store: any) {
@ -40,22 +40,22 @@ export default class Global {
return this.joplin_;
}
private requireWhiteList(): string[] {
if (!this.requireWhiteList_) {
this.requireWhiteList_ = builtinModules.slice();
this.requireWhiteList_.push('fs-extra');
}
return this.requireWhiteList_;
}
// private requireWhiteList(): string[] {
// if (!this.requireWhiteList_) {
// this.requireWhiteList_ = builtinModules.slice();
// this.requireWhiteList_.push('fs-extra');
// }
// return this.requireWhiteList_;
// }
// get console(): any {
// return this.consoleWrapper_;
// }
require(filePath: string): any {
if (!this.requireWhiteList().includes(filePath)) throw new Error(`Path not allowed: ${filePath}`);
return require(filePath);
}
// require(filePath: string): any {
// if (!this.requireWhiteList().includes(filePath)) throw new Error(`Path not allowed: ${filePath}`);
// return require(filePath);
// }
// To get webpack to work with Node module we need to set the parameter `target: "node"`, however
// when setting this, the code generated by webpack will try to access the `process` global variable,