Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
4k views

Working on a calendar display for a React project, and after creating this component, I have this error now appearing. The error, "Failed to compile. ./node_modules/date-fns/intervalToDuration....
Con1234's user avatar
  • 11
-1 votes
1 answer
4k views

Is there a way to convert .mjs files to .js? Not all hosts support mjs files yet, so I'd like to convert mjs files to js files. Background: Mozilla's PDFjs updated their code to use JavaScript modules ...
TwisterMc's user avatar
  • 157
0 votes
2 answers
114 views

import { on, EventEmitter } from 'node:events'; import process from 'node:process'; const ee = new EventEmitter(); // Emit later on process.nextTick(() => { ee.emit('foo', 'bar'); ee.emit('foo'...
Newbie programmer's user avatar
1 vote
0 answers
100 views

I'm using markdown files in my Next JS project, but when I view my files on local host there is no spaced between any lines or paragraphs. How can I fix this? Markdown file: **Research** The ...
agm's user avatar
  • 87
0 votes
1 answer
42 views

I just installed Netbeans V21 and saw that .mjs- files are not recognized by the spellchecker, even after importing the setup from V20. Then I opened Tools/ Options/ Miscellaneous/ Files and set "...
Paul's user avatar
  • 116
1 vote
1 answer
8k views

I updated the next.js and appeared an error. I searched that error and I didn't found the solution, even the official website of the next.js. The error is here: > [email protected] dev > next dev ▲ ...
Felipe SBM's user avatar
1 vote
1 answer
856 views

I'm pretty new to Webpack configuration and difference between cjs, mjs etc. When trying to build a component lib bundled by Webpack, im coming across this error when building (webpack command) ...
Coni Wright's user avatar
6 votes
4 answers
5k views

my hosting provider requires server files to be compiled to CommonJs and Angular 17 by default compiles files to Module JS *.mjs, I've tried to change the tsconfig.json but it changes the scope for ...
Freestyle09's user avatar
  • 5,578
3 votes
0 answers
283 views

I have a project made with CRA where I've imported an external library with this package.json "type": "module", "main": "build/index.umd.js", "module":...
Jacopo Trapani's user avatar
0 votes
0 answers
137 views

I'm working on a project in HTML and have been running JavaScript modules from it. However, I'm encountering the error in my browser that CORS is blocking a local file. I did some research and I heard ...
Evan Troxell's user avatar
0 votes
1 answer
825 views

I'm trying to get up and running with shikiji (a rewrite of shiki). As such, I've created this minimal example Next.js 13 project. It's the boilerplate project you get with npx create-next-app@latest ...
Ben's user avatar
  • 21.9k
1 vote
0 answers
261 views

Using this library: https://env.t3.gg/docs/nextjs to build env validator in nextjs. I am getting following error on "yarn dev": TS2307: Cannot find module '../../env.mjs' or its ...
Prashant Singh's user avatar
3 votes
3 answers
5k views

I've built a React application utilizing ViteJS with TypeScript. I've built the project using tsc && vite build. I've then built the Docker image based on my Dockerfile: FROM node:18.12.0 COPY ...
Akusas's user avatar
  • 529
0 votes
0 answers
13 views

I am trying to check if 'object' is saved in Local storage, and if it is then assign a global variable the object in a separate file, however, in the console it is saying Uncaught TypeError: "...
Cameron Shearer's user avatar
0 votes
1 answer
270 views

I'm trying to do a telegram bot who send vidéo import fetch from 'node-fetch' fetch("https://api.telegram.org/bot<api>/sendVideo", { method: "POST", headers: { ...
Aekyios's user avatar
0 votes
1 answer
1k views

I have a project that is using TypeScript, Prisma & NextJS. I want to see my database with prisma using the yarn prisma db seed command. However, I am facing issues. The problem is the file that I ...
mcclosa's user avatar
  • 1,505
0 votes
1 answer
23 views

I don't know how to explain this one. I'm trying to debug import 'datatables.net' isn't setting $.fn.dataTable. My theory was that I have 2 copies of jquery. To debug I added $.poop = 345 $.fn....
mpen's user avatar
  • 285k
0 votes
0 answers
76 views

I'm trying to pause this function using the breakTheLoop var but it wont work. This is the code if anyone could help me out ` async afk(message) { var breakTheLoop = false; while (!...
Lil Poop's user avatar
0 votes
1 answer
648 views

I am trying to add PDF generation to my mailer script implemented as AWS Lambda function. It is working fine locally, etc. When I am packing it with webpack 4, it does not work. My webpack config is ...
Igor Shmukler's user avatar
1 vote
0 answers
325 views

I am unable to load an .mjs file and run tests with mocha. I have tried mocha v.7.2.0 with flag --experimental-modules and v.10.0.0 without flag. I am using node v.14.15.4. The import statement that I ...
Marco Faustinelli's user avatar
0 votes
1 answer
771 views

Need some help with using a .mjs script and .js as well. I have one script.mjs file that looks like this. Simplifying here (the script needs to be .mjs file) import test from './test.js'; test(); ...
AlreadyLost's user avatar
3 votes
0 answers
807 views

I recently upgraded my project to Angular 13, I noticed that the new ng-packgr 13 bundles in .mjs extension by default. I have lots of code that uses require() to import some static assets and files. ...
vp310's user avatar
  • 320
7 votes
3 answers
3k views

(I know it might sound similar to missing js files from _nuxt folder, but unfortunately, I was not able to understand the answer from there) When I deploy my dist-folder to GitHub Pages, it contains ...
STh's user avatar
  • 812
1 vote
0 answers
205 views

When I'm executing pure node.js scripts I can change the path where it searches for node_modules as the following: export NODE_PATH="/home/user/node_modules" node "/home/user/different/...
raylight's user avatar
  • 727
0 votes
1 answer
2k views

I recently updated angular apollo from 2.6.0 to the v3.0.0 and this update broke my tests. I am using jest for my unit tests, while the app compiles and runs fine, my tests are unable to import any ...
Flavien Volken's user avatar
25 votes
2 answers
70k views

I created nest js project as following. nest new project-name and imported following from nuxt3 which is of type module of node js with mjs file extension (type definition of import doesn't require to ...
Anonymous Creator's user avatar
1 vote
0 answers
1k views

I'm trying to load a config inside a node module but I'm not sure which is a good practice to do it, I have this scenario: A config my.config.js: module.exports = { content: [ './src/**/*.{tsx,...
vitto's user avatar
  • 19.6k
1 vote
1 answer
1k views

Don't say "downgrade version" to this question. I cant do it because management want to maintain the latest versions. Is there any other alternatives...like converting mjs to js file in ...
Siri's user avatar
  • 43
0 votes
1 answer
2k views

I am trying to build a website that displays information from a database. My controller file has the code import express from 'express'; import * as exercises from '../REST API/exercises_model.mjs'; ...
310ToPoona's user avatar
2 votes
1 answer
296 views

I'm writing a small node cli app in a sub-folder of my project. I'm using .mjs files. Is there a way to enable VSCode intellisense? I tried with a .jsconfig with no luck.
Fred Hors's user avatar
  • 4,273
1 vote
0 answers
1k views

Context Our product is (sadly) still on Webpack 3. Hope to upgrade, but in the meantime, I am trying to use an npm library that bundles cjs, mjs and iffe files. (See package.json excerpt below). The ...
Lucas Arundell's user avatar
5 votes
2 answers
2k views

I have a backend CJS application & a frontend ESM application. And a node module I have created in ESM. The node module works fine for my ESM application because they are both using ESM import ...
warahi's user avatar
  • 51
1 vote
1 answer
3k views

I have a silly doubt. Which file, the importing file, the exporting file or both should have the .mjs file extension? Specifically for NodeJS. I have searched the web but didn't get my exact answer. ...
Valoruz's user avatar
  • 194
4 votes
2 answers
1k views

There is the isomorphic-webcrypto that pretends doing that but doesn't : it builds separate build for each target. There is the noble-crypto way to do it, but it's based on if-else conditions and ...
1000i100's user avatar
  • 419
2 votes
1 answer
142 views

I am building a WebApp and I am trying to add my own model instance in the place of default image field BUT I didn't find any ImageField. The Problem Page is showing ImageField but i didn't find any ...
Lars's user avatar
  • 1,270
1 vote
1 answer
3k views

I want to write some Jest tests for JavaScript functions in a .mjs file. Within these functions, variables are defined by calling other functions. For example: export function getCurrentVideo() { ...
Rowin_nb2's user avatar
  • 312
0 votes
1 answer
351 views

I have 2 files, module.mjs and project.js. In module.mjs there are all functions and classes used in project.js file. My problem is that I can't see class methods or suggestions or even class ...
Shammz's user avatar
  • 1
2 votes
0 answers
717 views

Using protractor and trying to switch to using es6 import instead of commonjs require approach I changed package.json and added (in the top section) "type": "module" I renamed my two app files from ....
Michael Durrant's user avatar
2 votes
1 answer
2k views

Node.js 13 recently rolled out an experimental ESModule loader, starting to take the switch away from CommonJS. However, code ran in an ESModule in Node.js isn't provided a require function, instead ...
Danii's user avatar
  • 355
607 votes
4 answers
478k views

I have started working on an existing project based on Node.js. I was just trying to understand the flow of execution, where I encountered with some *.mjs files. I have searched the web where I found ...
Keval Bhogayata's user avatar
10 votes
1 answer
16k views

I am able to run mjs files with nodejs using --experimental-modules flag. node --experimental-modules index.mjs package.json: { "name": "mjs-tests", "version": "1.0.0", "description": "",...
boleeluchshiy's user avatar
2 votes
1 answer
1k views

I am currently working with ES6 modules with .mjs extensions and creating test cases for some functions. I have chosen AVA due to its support of this extension type but the test executions are not ...
O.O's user avatar
  • 1,408
2 votes
1 answer
1k views

Node.js 12+ has new command-line option --input-type to run script inside Bash heredoc. However, it doesn't seem to be able to find Node.js modules installed in ./node_modules Here's how I install a ...
Dan D's user avatar
  • 8,769
2 votes
2 answers
3k views

is there a way to use an ecmascript module file as the main entry file to a cli exported using the package.json bin entry? i guess i would need to somehow provide the --experimental-modules flag, but ...
Jascha Ehrenreich's user avatar
1 vote
1 answer
347 views

I thought about having my, on npmjs released, module split into 2 or more parts (versioned), but both easily requirable / importable. The result should be: //index1.js const themodule = require('...
BananaAcid's user avatar
  • 3,560
2 votes
2 answers
2k views

It seems not possible to create a variable using eval in Node.js ES6 but I can't understand why. This happens to me on CentOS 7, but I don't believe OS is the problem here. Regular Node.js file (test....
Dan D's user avatar
  • 8,769
5 votes
2 answers
19k views

In the past, I used app-module-path whenever I wanted to have relative paths in my Node.js apps. If I use ES Modules through the .mjs format, how do I have the same functionality where a certain ...
Kevin Ghadyani's user avatar