Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey

All Questions

Tagged with
1 vote
2 answers
47 views

Alternative to 'assert' in Node JS with strict mode

I have a Firebase Functions project that has "type" set to "module" in package.json so that I can use ES6 syntax. Some of the files import data from another json file with a line ...
Matthew Michaud's user avatar
0 votes
1 answer
78 views

Module not found node_modules\@emailjs\nodejs\mjs\models\EmailJSResponseStatus'

I am trying to use EmailJs to send Emails from my NodeJs backend. I am using ES6 version of JS. I installed EmailJs using command: npm i @emailjs/nodejs After that I checked my nodemodules directory. ...
Shahood Amir's user avatar
1 vote
0 answers
121 views

Who can explain this weird inference in TypeScript?

I'm sure this is the expected behaviour but it looks counter-intuitive for me. Given the following snippet, why is item inferred as { a: number } instead of { b: number }? I was expecting a kind of ...
sgmonda's user avatar
  • 2,729
0 votes
1 answer
67 views

Converting CJS Module to ECMAScript when export contain an arrow function

On Server Application Structure documentation page of Socket.io, two methods are presented to use modules for better code clarity. Those modules are CommonJS. I managed to translate the first to ESM, ...
Akyno's user avatar
  • 1
0 votes
1 answer
24 views

Use graphql-schema-linter with a CJS config file

I have a command to run the linter graphql-schema-linter -c build-util/config but we have upgraded our project to use Vite instead of Laravel Mix. We are now using CJS files for some of the JS files ...
James Arnold's user avatar
-1 votes
1 answer
55 views

Using "type": "module" in package.json breaks javascript default parameters

I have a package.json file that contains the line "type": "module",. This line triggers errors when running node a_script.js. Its as if the default parameter functionality of ...
erikejan's user avatar
1 vote
1 answer
167 views

How to find where promise was created?

I posted this question a couple of days ago, then removed it after I was pointed that it essentially didn't demonstrate the problem I was dealing with. Then I was asked to restore the question, but I ...
d.k's user avatar
  • 4,470
0 votes
0 answers
27 views

Is there a way to paralellize db operations with Node.js, that I can use ES6 + typescript on?

I want to make a CRON job that handles some db operations by making X threads and assigning a range of indexes in the db that each thread will handle. I've tried using worker-threads but it has no ...
Dudu Dudu's user avatar
  • 181
2 votes
1 answer
700 views

Nodejs ES6 import issue with AWS Lambda & Layer

I'm using NodeJs(ES6) on AWS Lambda with node_module as AWS Layer and I want to publish a message on SNS. The above code works perfectly with CommonJs syntax but using import syntax (ES6) facing an ...
Mayur's user avatar
  • 621
1 vote
0 answers
81 views

Error: [ERR_REQUIRE_ESM] in Typescript Sequelize

When I try running any command in Sequelize, inside or outside the docker container, that needs the configuration file (In my case, config.mjs), I get this error: Error reading "build/database/...
Giovani Souza Kill StevePlays's user avatar
0 votes
1 answer
392 views

Webpack's ambiguous relationship with ES6 modules [closed]

Does Webpack support ES6 modules natively or not? This is a simple question but its answer seems to be more complicated than I initially thought. On one hand, Webpack allows you to use ES6 syntax ...
e18r's user avatar
  • 8,231
0 votes
0 answers
37 views

Uncaught ReferenceError: Cannot access 'sprocket' before initialization

I am currently working on an app and have run into the following error, Uncaught ReferenceError: Cannot access 'sprocket' before initialization This example below demonstrates the layering I ...
user1790300's user avatar
  • 1,745
1 vote
0 answers
30 views

Main function with ES Modues in JavaScript [duplicate]

In NodeJS we can follow the convention of having a main method, and we can ensure the main method is only executed if the module was ran by the user, and not accessed from an import as follows: ...
Andrew S's user avatar
  • 2,997
0 votes
1 answer
59 views

Router cannot be exported when using es6 syntax

I am trying to rewrite NodeJS modules(constant xxx = require('yyy')) into es6 format. I tried to export the router using export syntax in es6 but the following error always popped up: throw new ...
doraemon's user avatar
  • 845
0 votes
1 answer
209 views

In node using modules. how to change require to import for stripe

In my node application iam usign the modules system which i specified in my package file { "name": "ccbill-node-integration", "version": "1.0.0", "...
ttyagi3963's user avatar

15 30 50 per page
1
2 3 4 5
214