Questions tagged [esmodules]
57 questions
0
votes
1 answer
What is [ERR_PACKAGE_PATH_NOT_EXPORTED] exactly referring to in this case?
I am trying to serve the following http_server.js files on my virtual machine that I have set it up on digitalocean.
Why am I getting this error message?
this is my http_server.js file:
// Import required modules
import express from…

Sar
- 1
0
votes
0 answers
Is there any way to get Jest to handle importing libraries with esmodules?
Historically I've just used the transformIgnorePatterns option in Jest to convert esmodule libraries from esmodules to commonjs:
module.exports = {
transformIgnorePatterns: [
'/node_modules/(?!my-library)'
]
}
However this…

craigmiller160
- 5,751
- 9
- 41
- 75
0
votes
0 answers
failed to load resources or couldn't find the module. importing images in vuejs component
I'm trying to import my images, but i get couldn't find module or failed to load resources. I've used the require function, but it doesn't work too!
`
{{…

soroush mohamadi
- 1
- 1
0
votes
1 answer
Qwik errror during build. ReferenceError: exports is not defined in ES module scope
How to solve this qwik framework error during build a static site:
ReferenceError: exports is not defined in ES module scope
at file:///media/oem/MyFiles/8_DEVELOPMENT/nexasoft/server/@qwik-city-plan.mjs:1:1097
at ModuleJob.run…

Maik col
- 31
- 4
0
votes
2 answers
How to solve " [ERR_REQUIRE_ESM]: require() of ES Module" for Webpack case?
I tried to import the w3c-html-validator but got the error
Error [ERR_REQUIRE_ESM]: require() of ES Module D:(...)\node_m
odules\w3c-html-validator\node_modules\chalk\source\index.js…

Takeshi Tokugawa YD
- 670
- 5
- 40
- 124
0
votes
0 answers
How to create project in TypeScript for NodeJS 16 that runs as ES Module?
I have a NodeJS project written in TypeScript and I want to change it to generate ES Module so I can use my NodeJS shell with an import statement:
What I did was adding "type": "module" to package.json and setting up tsconfig.json:
"module":…

jcubic
- 61,973
- 54
- 229
- 402
0
votes
0 answers
Problems importing custom node-modules library
I'm developing a library for a Typescript codebase that I want to install via npm, but I am not able to import exported members as I would expect. My primary code is Typescript running on v4.7.4. My approach to exposing the imports from my library…

flimsy
- 204
- 1
- 10
0
votes
0 answers
NPM: sub-dependency of local dependency has require() in ES module and causes runtime error in production build
I have a Vue3 app under Vite. It's working marvellously in dev, but after adding a dependency, the production build falls over at runtime with require() is not defined. Grubbing down into node_modules, I see my dependency has a sub-dependency that…

bbsimonbb
- 27,056
- 15
- 80
- 110
0
votes
1 answer
AWS CDK NodejsFunction: import a module exported as "export ="
Is there any way to use modules (e.g. sharp) exported as export = someModule in a Lambda function defined using NodejsFunction in the aws-cdk-lib?
The require statement(const xxx = require('module')) does not seem to work with the Lambda TypeScript…

kusumoto_teruya
- 2,415
- 4
- 23
- 38
0
votes
2 answers
Import Map on Firefox v107 with `es-module-shims` polyfill is not working for dynamic import
I'm using Import Maps on my website which (according to caniuse.com) aren't supported on Firefox v107 or the latest (non-TP) version of Safari. I thought that the es-module-shims polyfill library would add support, but it doesn't seem to be…

Arcanist
- 46
- 6
0
votes
1 answer
Can webpack generate a module with exports?
I was able to create a webpack config to bundle few modules. The generated bundle looks as follows:
/* harmony default export */ const subscriptions = ({
... // my stuff
/******/ })()
;
I'd like to test the generated bundle so i need to have some…

4ntoine
- 19,816
- 21
- 96
- 220
0
votes
1 answer
How to provide test ESModule implementation in mocha test?
I have a mocha test which tests my code. My code uses another "core" npm package (which uses CommonJS modules). One of "core" the files ("synchronizer.js" file) requires "prefs" modules which is assumed to be provided at some point:
const {Prefs} =…

4ntoine
- 19,816
- 21
- 96
- 220
0
votes
0 answers
If there is no keyword like import, export, module, require, exports, can i regard it as esm and bundle it?
As title said, I found that in rollup-plugin-commonjs, it check AST by 'import' and 'export' to judge if it is esmodule. After check, it also check commonJs keywords like 'require/module/exports', and seem only transform commonJs which has export…

D.H.Lolo
- 53
- 4
0
votes
0 answers
Gulp Build | Systax Error: Unexpected strict mode reserved word
I am trying to set up one project which is very old. And when I run the gulp build command at my command promt, I encounter that error, and that error does not give me information about where the problem is. I can not upgrade my Node.js version…

bebeko
- 1
- 3
0
votes
1 answer
Export all files from a folder in es module
I have the following script which is attempted at exporting every single file from a particular folder, but I'm stucked at the export part of it.
Below is what I've attempted:
index.js
function exportAllFiles() {
fs.readdir(filesDir, (err,…

ololo
- 1,326
- 2
- 14
- 47