es6-modules Questions
3
Solved
I am stuck on a tutorial which is incorporating Tailwind, which in this case is tailwind 3.3.2.
Per the tutorial, I am supposed to open a file called tailwind.config.js and paste the below code fro...
Siloam asked 28/6, 2023 at 3:37
1
Solved
I've found the(?) github repository for UMD and it comes with this description (emphasis mine):
UMD (Universal Module Definition) patterns for JavaScript modules that work everywhere.
...
This rep...
Billfish asked 12/10, 2023 at 20:55
6
Solved
So I've been using ES6 style syntax with import/export on Nodejs with the ESM module loader. Everything has been fine until I started getting an error pertaining to imports.
Here's the error messa...
Paleobotany asked 8/2, 2020 at 0:8
2
Solved
I can't seem to be able to instantiate a web worker from a ES6 script file. MDN says it should be possible like this:
const worker = new Worker('my-worker.js', {type:"module"});
That doesn't wor...
Seraphina asked 25/9, 2018 at 18:13
4
Solved
I have a simple component which is supposed to render different kind of fields into my form component:
import React from "react";
export default class Field extends React.Component {
render() {...
Swelter asked 5/7, 2017 at 4:7
1
There is a simple question I cannot find an answer to.
When using:
Node 17 + Typescript
ESM ("type": "module" in package.json)
Can I implement mock for one function only? or m...
Intimist asked 6/3, 2022 at 19:34
2
Solved
I have a create-react-app project I'm migrating to Vite. That project uses "styled-components" like this:
import styled from 'styled-components';
const someDiv = styled.div`...`;
Now th...
Kingship asked 23/12, 2022 at 10:36
3
Solved
I am very new to ReactJS and Vite. I am working on some tutorials I have suddenly started getting below error. I have tried to re-install node_modules but didn't work.
[ERROR] No loader is configur...
Martial asked 5/3, 2023 at 7:28
1
Solved
When I am trying to run the build command for my react application I am seeing this error failing the build:
var stripAnsi = require('strip-ansi');
^
Error [ERR_REQUIRE_ESM]: require() of ES Mod...
Coltin asked 24/7, 2023 at 10:9
1
I am trying to import an ES6 module with CoffeeScript.
The javascript working code is the following :
import { MyModule } from 'my-module';
const mymod = new MyModule({
some-options: '...'
});
...
Wanderjahr asked 20/6, 2018 at 11:16
0
I am trying to build a react app with vitejs, the build is successful but when I try to serve it on browser I get this error
Uncaught ReferenceError: require is not defined
I have tried all the op...
Deputation asked 17/7, 2023 at 7:45
3
Solved
I'm trying to export default modules using index.js barrels but can't seem to get it to work. It works fine with named exports but not default exports.
Simplified Project Structure
/hellos
/comp...
Orogeny asked 22/12, 2016 at 19:18
2
How do I tell Webpack that it should treat my loader as an ES Module and not CommonJS?
My goal is to write a Loader that uses the ES Module syntax (export default...)
Demo (not working): https://st...
Magistrate asked 24/8, 2022 at 13:24
4
Solved
I have a page setup which references a couple of javascript files and has some javascript inline in the page, which is generated when the page is loaded.
One of the javascript files contains a clas...
Ladyfinger asked 3/11, 2020 at 15:9
3
Solved
I would like to rename the functions that I am exporting using the following syntax.
export const { selectIds, selectEntities, selectAll, selectTotal } = adapter.getSelectors(selectState);
So t...
Idler asked 17/5, 2019 at 15:15
5
I want to access data from script tag in html file, produced by cms.
Is it possible to do this without polluting global namespace?
I've tried to use es6 modules but I've failed and I couldn't find...
Moshe asked 30/5, 2019 at 9:16
1
Using dynamics imports like that:
const i = import('./path/to/module.js');
yields a Promise for that module. Assuming that ./path/to/module.js looks like that:
export function foo () {}
export fun...
Hide asked 31/8, 2021 at 10:36
3
Solved
I'm in the early stages of a new app that so far just uses vanilla JS. I'm trying to use ES6 modules for my Jest unit tests, so I followed the 2020 updated instructions on making this possible.
How...
Discommode asked 7/12, 2020 at 22:3
1
Let's imagine we have a file containing next JS code:
process.nextTick(()=>{
console.log('nextTick')
})
queueMicrotask(()=>{
console.log('queueMicrotask')
})
console.log('console.log')
a...
Trescott asked 29/12, 2021 at 11:47
3
Swiper 8 and Jest (support ESM) Must use import to load ES Module
enter image description here
enter image description here
How we can solve if I need to keep swiper 8 (without downgrade)
Drillmaster asked 6/5, 2022 at 12:35
3
Solved
I have a commonjs module, which was generated by Typescript 3.3.3.
Is it possible to use it with an es6 import statement? Here's what I have tried.
The generated module exports CountUp like this ...
Triggerfish asked 14/3, 2019 at 16:48
1
Solved
I have a TypeScript project, and I use Webpack to bundle the code to single JavaScript file. I'm using ESM only. When I try to run the distribution file by running: node ./dist/index.js I get this ...
Gin asked 12/4, 2023 at 17:57
4
Solved
I have seen questions referring to the mocking of default exports with jest around here, but I don't think this has already been asked:
When mocking the default export of a dependency of a module ...
Schooner asked 1/11, 2017 at 14:3
11
Solved
I want to use import fs from 'fs' in JavaScript. Here is a sample:
import fs from 'fs'
var output = fs.readFileSync('someData.txt')
console.log(output)
The error I get when I run my file using n...
Downbeat asked 25/4, 2017 at 23:1
7
Solved
Background
The JavaScript ES6 specification supports module imports aka ES6 modules.
The static imports are quite obvious to use and do already have quite a good browser support, but dynamic impo...
Thibault asked 20/2, 2020 at 9:58
© 2022 - 2024 — McMap. All rights reserved.