es6-modules Questions

3

Is it possible to use react-select directly from the browser without bundlers nowadays? The most recent version that I found to be able to do so was 2.1.2: How to import from React-Select CDN with ...
Psalter asked 10/7, 2020 at 21:29

3

I have a lambda function in node v14 that imports AWS SDK v3 from a lambda layer. In my function I can use my node modules from the layer only if I use CommonJS syntax: const { parseUrl } = require...

4

Solved

I am having a problem with importing ESM modules in my project based on Nest.js. As far as I understand, this problem is relevant not just to Nest.js but typescript as well. I have tried various th...
News asked 16/12, 2022 at 22:2

4

Solved

Is it possible to get the file name of the current JavaScript module? // item.mjs function printName() { console.log(...); // >> item or item.mjs }; If not, why not? Sandboxing, etc.
Bathhouse asked 26/8, 2019 at 19:22

3

Solved

I have a little html file that calls a javascript file, but when I'm trying to access it in the browser I'm getting the following error: Access to script at 'file:///C:/Users/jekob/Desktop/battles...
Bookshelf asked 13/9, 2020 at 16:49

4

I've seen Importing ES6 modules in CommonJS Node app? How to use ES6 modules with commonjs and https://nodejs.org/api/esm.html#esm_enabling And I still don't get it. Fairly new to javascript. The f...
Nit asked 17/12, 2021 at 16:49

9

Solved

I created a small JS module which I intend to make an npm package, but for now is just on GitHub. This module is written in ES6 and SCSS, and is thus relying on webpack and babel for transpilation....
Interactive asked 20/5, 2018 at 13:19

9

Solved

After looking at the documentation for the import/no-named-as-default eslint rule, I'm still confused about what exactly I'm doing wrong. I have the following file structure . ├── ButtonBack.css ...
Actinon asked 8/6, 2017 at 13:33

2

Going round in circles here, I'm using a module called get-folder-size https://www.npmjs.com/package/get-folder-size This only works, it seems, inside an ES6 module. So I've found out how to do thi...
Brooklyn asked 6/7, 2021 at 21:51

2

Given the example below. import { QueryClientContract, TransactionClientContract } from '@ioc:Adonis/Lucid/Database' The use of the colon has confused me and never understood where the imported fi...
Bishop asked 6/3, 2021 at 15:48

4

Solved

I dont know if I'm doint it wrong here, but I started a vanilla.js project with vite, I did my code, and everything is working with: npm run dev (which runs vite command). But when I run npm run bu...
Autopsy asked 30/4, 2022 at 19:38

2

I need to develop a nodejs application in which it should be possible to dynamically import ESM modules in a commonJS module during the run time. Without requiring the need to specify "type&q...
Cimbalom asked 2/6, 2023 at 7:38

2

Solved

I am trying to load a single ESM module in my TypeScript CJS project. All examples I find are for JavaScript. // example.ts export const example = async () => { const module = await import(&quo...

3

import functions from 'firebase-functions'; import UtilModuler from '@utilModuler' exports.helloWorld = functions.https.onRequest((request, response) => { response.send("Hello from Firebase!")...
Monaxial asked 24/1, 2020 at 22:41

4

Solved

Why do I get errors like these when I try to use the new Node.js support for ES6 modules (e.g. with node --experimental-modules script.mjs)? // script.mjs import * as fs from 'fs'; // TypeError: ...
Lycanthropy asked 2/6, 2018 at 21:59

3

Solved

This error is coming up when I am making a pull request. There is a GitHub workflow audit that runs checks on the pull request and it loads the test file from another repository. - name: Run Audits...
Andersonandert asked 10/4, 2020 at 18:7

2

I face the error: TypeError: Failed to resolve module specifier '../static/myJson.json'. The base URL is about:blank because import() is called from a CORS-cross-origin script. at runtime when th...

8

Solved

I want to use countUp.js on my custom theme in Wordpress. When I add the file with wp_enqueue_script(), I get an error: Uncaught SyntaxError: Unexpected token 'export' I've read that it can be fix...
Barrow asked 19/11, 2019 at 9:54

3

I have defined a prettier config in prettier.config.js. After adding "type": "module" to package.json (to enable using import/export syntax in node), running prettier fails with...
Topotype asked 19/2, 2022 at 11:31

3

Solved

So, I've spent quite a few hours today trying to put my nodeJS app that's fully using ESM (modules), and I've deployed it via cPanel on a server that's using Node v. 14.20.1. I'm constantly getting...
Samaria asked 23/10, 2022 at 20:24

10

Solved

As far as I understand it, if I create an ES6 module, I can only import it from code that is itself a module. This means non-module code, i.e. inline Javascript, or the Chrome dev tools console can...
Syne asked 29/9, 2018 at 15:47

3

Solved

Trying out Next.js but I'm struggling with the following. Just tried to install react-hook-mousetrap and imported it like I normally would: import useMousetrap from "react-hook-mousetrap"...
Dylane asked 17/2, 2021 at 15:25

3

I'm confused regarding events not firing in a particular ES6 module loading scenario. Here is a Codepen project to support my examples: https://codepen.io/fchristant/project/editor/AYQkGJ Consider...
Reconstructive asked 5/5, 2020 at 11:38

4

Solved

let's say I have a module that needs to be initialized once in the start of the app (to pass on configuration). module will look something like this : MyModule.js let isInitiazlied; const myMod...
Veilleux asked 26/2, 2018 at 13:25

2

I'm trying to create an automatic mock using jest in my ES6 javascript project. I'm using node v15.0.1, and jest 26.6.0 on ubuntu 18.04.5. I have a test file containing the following code: import R...
Switchblade asked 28/10, 2020 at 23:14

© 2022 - 2024 — McMap. All rights reserved.