Quantcast
Channel: Active questions tagged require - Stack Overflow
Browsing all 141 articles
Browse latest View live
↧

importing and exporting modules in react

I'm working in a React.js project which I need to import some JavaScript in others, and some others I have to export it.For example I have A.js which needs some library:var EventEmitter =...

View Article


Require function returning an empty Object in NodeJS [closed]

I have 2 files to import an add function i made and execute it**math.js **function add (a,b){ return a + b; } module.export = add();Node1.jsconst math = require("./math.js");console.log(marh(2,5);i was...

View Article


Difference between require, include, require_once and include_once?

In PHP:When should I use require vs. include?When should I use require_once vs. include_once?

View Article

Uncaught Reference error: require is not defined [duplicate]

Below code cause this issue return iconLists.reduce((list, name) => { const pL = list; pL[name] = require(`./svg/${name}.svg`) return pL }, {})}tried different plugins no luck.vite.config.jsimport...

View Article

How to create a NPM package installed globally to run code from terminal with...

I created a javascript with node to rewrite javascricp file to make all require to import and my code do it perfectly. My NPM package is named require2import.it's here on Github.If run my script from...

View Article


require is not defined in js file that compiled from typescript file

Hello,I am currently working on a Firebase project, and it was working fine until I converted the JavaScript code to TypeScript. Since then, I’ve encountered many problems. I resolved most of the...

View Article

Vuejs access to file outside of the application

I have several files on my server located at /var/www/files/My vuejs is in ~/Dev/appI did : let file = require('/var/www/files/myfile.jpg')then npm run build my app.But I have this error 🫣 :Error:...

View Article

Fix ruby project inconsistent files using zeitwerk

For a large (non-Rails) ruby project with thousands files not following naming convention for class, module and constants that uses a lot require and require_relative and potential circular dependency,...

View Article


How to have aliases with nodejs import

I have a project using node.js v16, and more and more npm libs are not anymore compatible with require, and need to be used with import.Until now i was using package.json to have my root directory as...

View Article


Why is my Apache require by IP not working for a subdirectory?

I want the index page of example.com to be public and the /col directory to be restricted. The IP shown is what appears in my apache log file so I know it's my IP.<Directory...

View Article

How to "require" a LUA script within a Spoon-package?

We have base LUA file ~/.hammerspoon/init.lua which can load a spoon package:hs.loadSpoon("Foo")Now we have our package file init.lua by path:~/.hammerspoon/Spoons/Foo.Spoon/init.luaIt works fine.I...

View Article

Image may be NSFW.
Clik here to view.

Import a library into a chrome extension content script?

I am looking to import a library into one of my chrome extension's content scripts. Lets take chart.js for instance.I've already looked at this post, but I'm not sure if it is what I need. If it is,...

View Article

Error: Failed to open stream: No such file or directory

I have this code and the same twilio.php library running on both a local (XAMPP) server and a VPS:checkConnection.php<?php // Include Twilio PHP Library here require...

View Article


Cpanel React js dynamic site not running

I am trying to run my dynamic node react js web app on cpanel. But as I try and 'run js script' of npm run dev I get this error message...returncode: 1stdout:vite-project@0.0.0 dev...

View Article

require() empty string id error on non-empty strings

When I try to run my js code there appears to be an error that shouldn't exist no matter what.Basically i loop through an array of strings (paths), i try to import an object (using require) using each...

View Article


Syntax for using math.js in typescript file

I am writing an office 365 addin using typescript. I am trying to use functions from math.js. In my home.html head tag, I have the line:<script...

View Article

What is the 'import * as ...' equivalent for require?

When using the ES6 import command, you can use an alias to import all functions from a file, for example:import * as name from "module-name";Is there an equivalent way to do this using require,...

View Article


How to use --exec option in nestjs command

I'm trying to use the --exec option to run a command before the nestjs server start (--require).I want to modify the start:dev script in my package.jsonBut I can not make it work, always got an...

View Article

is there a require for json in node.js

I would like to include a couple of JSON files in my JavaScript code that are in the same directory as my JavaScript source file.If I wanted to include another JavaScript file I could simply use...

View Article

Is it possible to clear node.js require cache using express.js?

I wrote node.js small app for myself which was using small js code to clear require cache before handling request:let clearCacheif (process.env.NODE_ENV === 'development') { const {cache} = require...

View Article
Browsing all 141 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>