Category : module

I’m discovering Electron and I’m facing a problem: I can’t implement my "common.js" file in my "test.js" script. Here is the architecture of my project: rootProject -features(folder) -common.js -test.js -index.html common.js const hello = "hello"; module.exports = { hello }; test.js const {hello} = require("./common.js"); console.log(hello); index.html <body> <h1>Hello World!</h1> <div class="flex-container"> <span id="timeAfterRefreshGasFees"></span> <span ..

Read more

Looking at the Leaflet docs, I don’t see how to import Leaflet as an es6 module. And more importantly, all the Leaflet plugins as well. Skypack converts Leaflet to modules: import * as leaflet from ‘https://cdn.skypack.dev/leaflet’ But I’m not sure how safe this approach would be. I’d prefer unpkg, but this: https://unpkg.com/[email protected]?module .. produces: Package ..

Read more

I’m working on a CLI tool. I used "commander", which is a CommonJS module, to parse command-line arguments. I also want to use "p-map" to manage concurrency. However, "p-map" is a ES6 module. Also I’m using Typescript. Now both code editor and Typescript compiler won’t complain. However I cannot execute my CLI tool. If I ..

Read more

Sorry if there are some basics I’m missing here, I’m quite new to this. Let’s say I have three files. server.js, index.html, module.js. I want data input in index.html to change a variable in module.js. Basically I think the process should go: User submits a form (as an array) on index.html server.js receives this info ..

Read more

I am trying to export a const genkey from app.js and import it on test.js. My code is below: export const genkey = HDkey.fromMasterSeed(Buffer.from(mnemonic)); Trying to export const genkey but it says error: export const genkey = HDkey.fromMasterSeed(Buffer.from(mnemonic)); ^^^^^^ SyntaxError: Unexpected token ‘export’ To import I’m using the code in my test.js import {genkey} from ..

Read more