Questions tagged [es6-module-loader]
ES6 Module Loader Polyfill dynamically loads ES6 modules in browsers and NodeJS with support for loading existing and custom module formats through loader hooks.
es6-module-loader
293
questions
0
votes
1
answer
149
views
Cannot use import statement outside a module (Vanilla JS) [duplicate]
I'm getting Cannot use import statement outside a module(Vanilla Javascript) while testing a simple demo app locally using nano server.
data.js
const data = {
"type": "Feature",...
1
vote
1
answer
498
views
Using multiple loaders in Node
Loaders in Node can be used to hook into the module loading process, intercepting import or require calls. This works fine, but sometimes you might want to use multiple loaders. For instance, you are ...
0
votes
1
answer
355
views
Are circular references ok in .d.ts files?
When creating typescript declarations for a javascript library, is it ok to have circular imports in .d.ts files? E.g.:
file a.d.ts
import { B } from "./b";
export class A { ... }
...
file ...
0
votes
1
answer
201
views
What does @ mean while importing libraries in JavaScript? import '@library-name' [duplicate]
For example:
import { createDrawerNavigator } from '@react-navigation/drawer';
What is the significance of the '@'?
I tried looking it up but the answers explained its usage as a pointer to the root ...
0
votes
1
answer
887
views
Cannot use import statement outside a module CLIENT-SIDE
At client-side, I want to import only a specific part of my Javascript module.
But I wanna do that on demand, like when a user performs an action that needs that specific part of the module.
I was ...
0
votes
1
answer
42
views
Loader reference to handle the react error
When i try implementing the following code
const handleClick = (click) => {
let result = {};
const output = Object.keys(value)?.map((ele) => {
if (ele === click) result[ele] = true;
...
2
votes
1
answer
2k
views
ES6 module fails on Safari mobile (iOS14.6)
I'm experimenting with Javascript modules both via desktop (latest Chrome) and mobile (Safari with iOS 14.6) and my code works perfectly on the desktop (standard browser or mobile emulation mode) but ...
0
votes
1
answer
4k
views
Javascript you may need an additional loader
We are working on the following module js(javascript only), which allows to generate random colors.
Link: Github
When we try to install the module on an example on codesandbox, we have no problem.
But ...
0
votes
1
answer
483
views
Calling a method inside an IIFE exported method
i have a script which i want to expose a function using JS Modules this script is compiled using esbuild.
pre-transpiled file (index.mjs)
const NakamaWrapper = require("./nakama").default
...
2
votes
0
answers
739
views
dynamic import from literal string instead of path in ES6
is it possible to import from a js string?
import(`alert("Hello")`);
which gives us more control over http fetching, like loading from protected url with access token.
1
vote
0
answers
178
views
TypeScript Clientside usage
I am in the process of migrating my project from JavaScript to TypeScript, so far everything went according to plan, but now I encountered a problem.
On the server side the TypeScript files are seen ...
0
votes
0
answers
186
views
Declaring functions using a require statement inside a Node.js class
I am willing to define class methods by using require statements. As follows:
class A {
constructor () {}
static functionA = require('./someFileA');
static functionB = require('./someFileB');
...
1
vote
0
answers
139
views
How do I import @material/mwc-button without precompiling?
I have the following code...
<html>
<head></head>
<body>
<mwc-button label="Hello World"></mwc-button>
<script src="https://unpkg.com/...
5
votes
1
answer
2k
views
Is circular type reference a bad thing to do In TypeScript?
I encountered below code snippets which contain a cyclic importing dependency on type reference.
// Foo.ts
import { Bar } from './Bar';
export interface Foo {
isBarOK: (bar: Bar) => boolean;
}
//...
4
votes
1
answer
7k
views
Jest test suite failed to run because of "TypeError: Cannot read property 'xxx' of undefined"
I am trying to reorganize the import/export statements of my TypeScript React project to make them shorter and cleaner, basically by the approach of defining an index.ts file in each feature specific ...