The difference between "require(x)" and "import x"
I've just started working on a small node project that will interface with a MongoDB. However, I cannot seem to get the relevant node modules to import correctly, even though I have installed them...
View ArticlePHP include/require inside functions
Having functions that are quite big and they are loading every time the page is loaded, would be better to write function foo(){ include(.../file_with_function's_code); return; } to minimize the size...
View ArticleHow can I set require() to dynamically update with an image path in React?...
I have an image on my About page of a react app which i'd like the image to change to a new image every 5secs. I have set up my hooks and my aboutImg state is initially set to require('./img/rope.jpg')...
View ArticleHow to dynamically render a markdown file in Angular?
I'm trying to write an Angular component that renders markdown files as part of the webpage, using the ngx-markdown library. Looking at the library's official demo, it has a list of files that it...
View ArticleBackbone insert data inside Model from another
I have a simple app in backbone where the logic isn't clear for me, It's my second app and I don't know if is good the logic and how I have construct it.The goal is when I load a page I want to...
View Articlephp composer use function and call in required files doesn't work
I'm trying to declare the JWT classes in a separate file to use them in functions, but it's not working, and I really don't understand why.If I put the use declarations from use.php into jwt.php, it...
View ArticleMy js script uses 'require', which I can't use in browser. Will changing to...
I am setting up a webhook receiver just to learn the ropes. I have run a number of tests that work fine with node. Now I am attempting to put this receiver on a publicly hosted page so that I don't...
View ArticleHow to catch error of require() or include() in PHP?
I'm writing a script in PHP5 that requires the code of certain files. When A file is not available for inclusion, first a warning and then a fatal error are thrown. I'd like to print an own error...
View ArticleWhy can't C++ tell return_void and return_value are mutually exclusive?
I am trying to define my own coroutine promise type, and I have the following declarations:void return_void() requires std::same_as<T, void> {}template<class X>void return_value(X&&...
View ArticleJS function works only when hard refreshing page
I'm sure this has something to do with the timing of things loading, but I can't figure it out.I'm using Oracle's Jet charting libraries and trying to convert the y-axis to a percentWhen I run this...
View ArticleNode.js global require
how can i require a module globally so i can use it in different modules without having to require it again?or do i just have to do that everytime?is there any best practice for this?heres an example...
View ArticleUse template functions inside template
I want to implement the following for more than one (i.e. many) functions (function1(), function2(), ...etc.).Currently I have it separately as follows:template <typename T>concept iterator_1 =...
View ArticleHow does this "require" statement with a dynamic filepath work?
require dirname(__FILE__).'/yahooPHP/lib/Yahoo.inc';This line is in one file in one directory and I am having trouble determining how to reference a file in another directory. What does this expression...
View ArticleNode require returns undefined
I have an ErrorHandler class in my node code that handles all occuring errors.Every Error has its own class. All classes are placed in seperate files so the folder structure...
View Articleplugin externalize-deps - This package is ESM only but it was tried to load...
I am installing a plugin in Vite, but I run into an error message stating that the package only supports ESM, not CJS.package.json{"devDependencies": {"example-package": "^1","vite": "^6"...
View ArticleNode.js cannot find installed module on Windows
I am learning Node.js at the moment on Windows. Several modules are installed globally with npm.cmd, and Node.js failed to find the installed modules. Take Jade, for example,npm install jade -gJade is...
View Articleexecute lua string as lua code
I want to share lua modules with coworkers. In order to get the latest version of shared modules I want to store and fetch them with a web server.My questions is: Is it possible to load lua code...
View ArticleSave an object containing functions to a .js file
Say I have an object like below: let obj = { mounted: (value) => { return "Yeesss"+ value; }, a: "123123", c: { d: (key) => { return key + 1; } }}I can stringify the object and its functions like...
View Articlerequire() of ES Module \node_modules\string-width\index.js from...
`#11 44.55 ERROR require() of ES Module /app/node_modules/string-width/index.js from /app/node_modules/wide-align/align.js not supported.#11 44.55 Instead change the require of index.js in...
View ArticleLoad Lua-files by relative path
If I have a file structure like this:./main.lua./mylib/mylib.lua./mylib/mylib-utils.lua./mylib/mylib-helpers.lua./mylib/mylib-other-stuff.luaFrom main.lua the file mylib.lua can be loaded with full...
View Article