Switch scripts to module because of node-fetch v3
This commit is contained in:
parent
58c657e38a
commit
9c59fa10b6
4 changed files with 17 additions and 11 deletions
|
|
@ -1,8 +1,12 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fetch from 'node-fetch';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fetch = require('node-fetch');
|
||||
import vm from 'vm';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const outDir = __dirname;
|
||||
|
||||
var includeList = [
|
||||
|
|
@ -18,7 +22,7 @@ var includeList = [
|
|||
];
|
||||
|
||||
function extract(constantsJs) {
|
||||
eval(constantsJs);
|
||||
const getLayerDataByID = vm.runInNewContext(constantsJs + '; getLayerDataByID');
|
||||
|
||||
for (let i = 0; i < includeList.length; i++) {
|
||||
let id = includeList[i];
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fetch from 'node-fetch';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const outDir = __dirname;
|
||||
|
||||
const includeList = [
|
||||
Loading…
Add table
Add a link
Reference in a new issue