Questions tagged [esmodules]
57 questions
8
votes
1 answer
Use d3 in an commonjs npm module
I am creating a private npm package to visualize the structure of a Vuejs project. d3 seems to be on of the best choices for a visualization, but I have problems to include it in my script. In the package.json I defined my script under the bin…

link
- 491
- 1
- 4
- 13
6
votes
2 answers
Cannot import package in AWS lambda with Nodejs14.x ES module
I have a layer where the path of node_modules is nodejs/node14/node_modules.
Using that layer, and I try to import a package in a Lambda function, say 'aws-cloudfront-sign', like this:
import cfsign from 'aws-cloudfront-sign'
I got error…

Lam
- 93
- 1
- 2
- 7
3
votes
0 answers
Nodejs + TS CommonJS vs Module issue for Inquirer package
When i imported inquirer i have started getting errors about CommonJS and Modules errors. So this current one suggesting my to use dynamic imports const inquirer = await import('inquirer'); then i also had to change in tscondig "module": "ES2022",…

Marius
- 1,664
- 2
- 16
- 28
3
votes
1 answer
Error: ENOENT: no such file or directory, open 'src/protos/user.proto'?
I'm creating a node.js gRPC service. I'm using the photo buff as an npm package in this service. so the proto buff package is structured as below.
and I have published this package to the GitHub npm package registry. then I used it in my…

Sathya Molagoda
- 531
- 1
- 6
- 17
2
votes
0 answers
VITE Buildiing phase: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'vite-plugin-commonjs'
I'm trying to dpeloy my first vite project but i'm getting the following error:
9:32:18 AM: $ npm run build
9:32:18 AM: > entertainment-app@0.0.0 build
9:32:18 AM: > vite build
9:32:18 AM: failed to load config from…

Joao Ghabriel
- 31
- 2
2
votes
0 answers
How to divide gulp tasks into multiple .ts files?
I've tried to setup Gulpfile configuration only with Typescript. Created in project's root folder named gulpfile.ts with index.ts:
import { task } from 'gulp';
import { clearBuild } from './tasks/clear-build';
task('build',…

Evgeniy Reut
- 21
- 2
2
votes
1 answer
Are Native Node Absolute (ie. Root-Relative) Paths Possible With ES Module Named Imports?
Normally in Node one can useNODE_PATH=./src" to make it so that instead of:
import { foo } from '../../../bar'
You can just do:
import { foo } from 'src/bar'
However, that only works if you use the esm package (ie. node -r esm): NODE_PATH doesn't…

machineghost
- 33,529
- 30
- 159
- 234
2
votes
3 answers
Getting error when importing fontawesome icons
I'm trying to build a simple website using Astro, it runs perfectly fine when using astro dev but I can't build the website using astro build because this happens:
The error I'm getting:
error Named export 'faGithub' not found. The requested…

Uri
- 31
- 6
2
votes
2 answers
Using ES Module packages in Azure Typescript Function
I am unable to use the package p-map in my Azure Function. I get the following error:
Worker failed to load function: 'serverless' with function id: ''.
Result: Failure
Exception: Worker was unable to load function serverless: 'Error…

Ensar Ishakoglu
- 133
- 6
2
votes
1 answer
Dynamically load React component library from URL?
I am working on documentation tool for Typescript library. The idea is to leverage parcel's watch mode to continuously build the library, and use the same in a pre-built documentation app.
For the same I need to load a module library (built in…

sangupta
- 2,396
- 3
- 23
- 37
2
votes
3 answers
How to import via a URL using ES modules?
I want to import a library like axios directly from a URL and use it.
I don't want to add it as a script which adds axios to the window object (as shown below).
index.html