7,700 questions
1
vote
2
answers
126
views
Including Autodesk Viewer as AMD library in SAPUI5?
It seems like the latest Autodesk Viewer update to version 7.115.0 on November 28 the module has been changed to a Universal Module Definition (UMD).
We are importing this script in the SAPUI5 ...
0
votes
1
answer
87
views
Require.js fails to load data-main script (looks into wrong place)
Requirejs library fails to load script defined in data-main attribute for require.js script. According to browser output it looks into wrong place. Can't sort it out why and how to fix it. Created ...
1
vote
2
answers
106
views
Webpack automatically resolve default import
I am attempting to migrate our single-page application from RequireJS to Webpack. As part of this transition, I am gradually rewriting our hundreds of modules from ASM define() syntax to modern ESM ...
0
votes
0
answers
118
views
Using Javascript import to replace a require() call when importing from a Typescript module
I am maintaining some Javascript code in a React application that imports from a Typescript library using the require function.
The import statement looks like this:
const utc = require('dayjs/plugin/...
-1
votes
2
answers
154
views
Unable to reduce React app build bundle size
This line of code is expensive to run:
require(`./path/to/large_file`)
Without it, the React app build bundle resulted in 36 MB.
With it, it resulted in 92 MB.
The above line of code is run during ...
1
vote
0
answers
75
views
Ag-Charts 10.2 is Not Loading in Require.JS App
I have a require.js app and I am adding enterprise edition of Ag-Charts in it. I can successfully add 9.0 version of Ag-Charts but when I try to add 10.2 version, it's not loading somehow. Can someone ...
0
votes
0
answers
79
views
require js is not supporting optional chaining at the bundling process (grunt bundler)
Running "requirejs:desktop" (requirejs) task
Error: Parse error using esprima for file:
C:/projects/GitProjects/vendorgames-sonarqube/ndcasinocommon/base_common/fcga
mes/vendorgames/...
1
vote
0
answers
59
views
Migrate a large project using Require.js
I work on a fairly large Javascript project (~863 files), where all the code is distributed in a modular way, being practically one file per class (object-oriented). Some things are loaded on the fly, ...
-1
votes
1
answer
1k
views
How do I use both `require` and `import` in a Node.js script?
having a node js basic project setup with package.json , install a package and try to use both require and import statment in the same file; to do that here is what did so far but not working.
First ...
-1
votes
2
answers
321
views
Undefined error while loading Survey-creator-core using RequireJS
I am using requireJS in my project and want to load survey-core and survey-creator-core.
survey-creator-core has a dependency on survey-core when i checked the js file of survey-creator-core.
I got ...
-1
votes
2
answers
181
views
Require JS with jest to mock function in same module
I am working on a NetSuite suitescript customization and would like to write the test with Jest.
Since suitescript run with Require JS, I would like to know how to correctly mock the function as I ...
1
vote
0
answers
386
views
RequireJS Error "No define call for core/first" on Moodle Installation via Docker
I'm working on a project that involves deploying Moodle using Docker. The setup includes two Docker containers: one for the database (MariaDB) and one for Moodle (i also have a container for django, ...
0
votes
1
answer
537
views
Error: Cannot find module '../controllers/userController' in Express.js Application
I am working on a full-stack project using Express.js for the backend and MongoDB for the database. I am encountering an error when trying to start my server. The error message is as follows:
Error: ...
0
votes
2
answers
1k
views
Node.js import results in ERR_MODULE_NOT_FOUND
Here is how I built and installed node.js(version: 20.11):
./configure --prefix=/home/tester/node
make -j8
make install
Here is how I set the environment:
export PATH=/home/tester/node/bin:$PATH
...
0
votes
0
answers
61
views
requireJS element is not a function
simple example RequireJs
I get Error :
Uncaught TypeError: hi is not a function
say.js
define(function () {
var say={};
say.hi=function hi(){
console.log('hi');
}
return say;
});
...
0
votes
0
answers
1k
views
Webpack warning "the request of a dependency is an expression" goes away using template strings instead of variables. How?
I had a webpack warning in my nextjs dev server saying
Critical dep: the request of a dependency is an expression
This was because I imported some modules using variables, but the warning got away ...
0
votes
1
answer
101
views
I have an error with my singleton design pattern
I am attempting to do a singleton pattern in javascript. I am getting error message "Uncaught TypeError: route_socket.getInstance is not a function". I was wondering what am I doing wrong. I ...
0
votes
0
answers
92
views
How to use RxJs with Require.JS
I try to use RxJs with Require.JS on Html page (without Angular or WebPack), this is my test
<script src="http://requirejs.org/docs/release/2.3.6/comments/require.js"></script&...
0
votes
0
answers
49
views
Why jest.spyOn doesn't invalidate module cache when requiring single function?
I have
// mod1.js
const f = (_n) => console.info('a:', _n) || _n * 2
module.exports = { f }
// mod2.js
const { f } = require('./mod1')
const g = (_n) => 3 * f(_n)
module.exports = { g }
and a ...
0
votes
1
answer
533
views
Flutter web project with javascript modules that use requireJS (Monaco editor in Flutter web)
I'm trying to use the Monaco editor in Flutter Web.
The simplest way that I see is to sync load all the resources example.
Here's a stand alone html file:
<!DOCTYPE html>
<html lang="en&...
1
vote
0
answers
70
views
Unable to resolve "../assets/srt/Audio2.srt" from "components\PlayerSound.js", how can I fix it?
I'm working on a react native project with expo. My app will display a video and I want to display subtitles with it. I got multiples videos and srt files so I don't use the subtitles module of expo-...
0
votes
0
answers
41
views
Require independent instances of module inside class
I am a beginner in nodejs. I am developing a vscode extension based on this guide. I defined a class that requires an external js module, e.g. :
thepanel.ts:
import * as vscode from "vscode";...
0
votes
1
answer
371
views
Form Navigation in Temenos Quantum Visualizer
How do we navigate between different forms using pure coding only? And should I use the respective Form Controller to write its code?
I can easily implement this with the help of the user interface ...
2
votes
1
answer
3k
views
Why the import * as fs from 'fs' doesn't work and gives me an error?
So this is my problem:
import * as fs from 'fs';
var downloads = 0;
const fs = require('fs')
fs.readFile('tp.txt', (err, inputD) => {
if (err) throw err;
downloads = inputD.toString();
})...
1
vote
0
answers
1k
views
Debugging Uncaught Error: Mismatched anonymous define() module: undefined
I use Magento 2 and requireJs optimiser and quite often can run into below error after creating my bundles and visiting my storefront:
Uncaught Error: Mismatched anonymous define() module: undefined
...
1
vote
0
answers
356
views
Uncaught ReferenceError: require is not defined error while running react app
My react application is not getting properly loaded and when I open browser console it is showing below error-
external node-commonjs "events":1 Uncaught ReferenceError: require is not ...
1
vote
0
answers
325
views
The application compiled using pkg in Node.js does not recognize the files added to the project folder. What should I do?
I need to be able to add new .js files to the /public/bots folder after compiling my project into an exe file using the pkg module. Upon launching the application, these new files should be detected, ...
1
vote
0
answers
107
views
How can I Display data labels with Chart.js using RequireJS
I am hoping to keep things simple by storing the required files on the server hosting my webapp. I am using the latest version of Chart.js and the data label plugin. The data label file is in the same ...
0
votes
1
answer
85
views
Check what files are in a directory using js in .html file
I am trying to figure out how to read what how many/what files are located within '../mydirectory/images' in a .html file that I have that is the landing page for my website. I need this so I can ...
0
votes
1
answer
930
views
How to solve Uncaught ReferenceError: require is not defined
Problem
I'm working on migrating my product information from Magento to Shopify, and one of the field is an entire HTML document. While the HTML and CSS can be correctly display, the jQuery codes in &...
0
votes
0
answers
41
views
JSON variable inside the require.js block is not accessible outside the require.js block
I am working on an developing a data source object (called data variable in my program) based on Solr queries using require.js
My goal is to pass the data variable to an API that I am developing, ...
0
votes
0
answers
23
views
How use node_modules when textisolation true?
I am currently making an application with Electron but when I package my application I have a white screen when I set the parameter textisolation: true.
But when I set it to false my modules like ...
0
votes
0
answers
201
views
Using require with webpack in my Chrome Extensions blocks my async calls
I am building a Chrome Extension that does STT to Google Documents. It works fine, I managed to add some features to it, but now I want to add an option to select some text from the document. For this ...
0
votes
2
answers
915
views
Using Underscore.js with require.js: Uncaught ReferenceError: _ is not defined
I have Underscore.js 1.13.2 and I include it using requireJS 2.1.14.
paths = {
'underscore': my_folder_path + "/underscore", // for underscore.js
.. //path of other files
}
I see in the ...
0
votes
1
answer
1k
views
Monaco editor in content script. "Define is not defined", "synchronous require cannot resolve module 'vs/editor/editor.api'."
I'm trying to make it work in content script:
manifest.json
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": [
"monaco-...
0
votes
1
answer
120
views
How to use require to execute an IIFE that takes arguments
I know that when you do require('./file') where the file.js export is an IIFE, that function will immediately run (obviously). I'm just not sure how to deal with this if the IIFE takes arguments.
I'm ...
1
vote
0
answers
1k
views
Vite build uses require? Receive error require is not defined
I have an app that uses Vite (runs on electron, using electron builder and the plugin for vite) and I had a single page app and the build/app/etc were working great. But, I needed to add a new page ...
1
vote
0
answers
108
views
How do I setup a fallback for Webpack require?
Webpack's require is being used to dynamically load images based on the state of the page.
Console Error
Uncaught Error: Cannot find module './target.png'
at webpackContextResolve (.png$:82:1)
at ...
0
votes
0
answers
31
views
Is RequireJS execution order guaranteed for dependent scripts once their dependency is loaded?
In RequireJS, if multiple scripts have dependencies on a module, are those scripts guaranteed to get executed in the order they are defined once the module is loaded?
Basically, with the following ...
0
votes
2
answers
439
views
How to correctly load dynamic images in Vue.js?
At the moment I'm just starting to learn Vue.js. I can't solve such a problem, when using "require()" an error appears: "Module not found: Error: Can't resolve". If I use static ...
-2
votes
1
answer
169
views
How do I import and export files in javascript?
I created a separate file for a function and exported it to my main file to use by "import Header from "./Header.js";" but it is throwing error that "require is not defined&...
0
votes
0
answers
329
views
Uncaught ReferenceError: Handlebars is not defined when using handbelar.js
I am copy pasting the code from the tutorial here: https://sabe.io/tutorials/getting-started-with-handlebars-js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"&...
1
vote
0
answers
523
views
Plyr is not a constructor
I've been struggling for a while to include a Plyr library (read & customise audio src) and I need to embed it via requireJS (important). all the other libraries work except this one, I wonder ...
0
votes
1
answer
579
views
Is it possible to retrieve all imported objects in ES6 modules?
With RequireJS, you can do something like:
define(['a', 'b', 'c'], function(a, b, c) {
console.log(arguments);
}
Is it possible to do something similar for an ES6 module? Ex:
import a from 'a.js'...
0
votes
1
answer
133
views
Problem with using Govuk-Frontend npm package in Oracle JET Application
Problem with 'Get started' (https://frontend.design-system.service.gov.uk/get-started/)
I am trying to use Govuk-Frontend npm package in Oracle JET Application. I have included the package in ...
0
votes
1
answer
107
views
Initialize requirejs config.paths with relative path
I want to implement some feature to my project. This feature is taken from sample-app in github repo. The way it works is i just using theirs css and js file and uploaded to jsdeliver so i get the cdn ...
1
vote
0
answers
41
views
Using requirejs with createpool - Write mysql data to HMTL
I'm trying to write data of a mysql database to a HTML file (website). I have one HTML file and one script (music_explorer.js) that is declared in the HTML file.
I was using this for connecting the ...
0
votes
1
answer
266
views
Error: requireJS config is not a function
My Project structure looks like this -
src
|- main.js
|- math.js
math.js is just an AMD module and I am requiring it in main.js
I have installed require.js using npm and requiring it in main.js
//...
0
votes
1
answer
193
views
Why does my compiler causes an error due compiling my .ts file into .js?
I have 2 .ts files:
linked_list.ts
class Node {
*****
}
class LinkedList{
*****
}
export {LinkedList};
and index.ts:
import {LinkedList} from "./linked_list";
class LinkedListStack{
***...
7
votes
0
answers
6k
views
"Uncaught ReferenceError: global is not defined" with Vite
I'm getting the error from the title in my Vue app with Vite. I seem to have tried everything that I could find online but nothing really seems to work in my case.
The problem started when I installed ...