Comments (2)
Maybe I can help. I think what @hendrul is saying is that if you follow the instructions provided in the readme, it doesn't work. When node.js sees "require.context", it complains "TypeError: require.context is not a function." At least, that is my experience.
I'm at Node.js version 10.15.1. I've tried placing this line in a couple places:
require('require-context/register');
(Does the above line belong in the .js file where you're trying to use require.context() or in a .js file that gets required in before the .js file where require.context() is used?)
Nothing I've tried has caused require.context() to not throw the above TypeError.
I added the second "require" from the readme:
var requireContext = require('require-context');
without seeing how it could help require.context() be found, and it didn't, so I changed the line of code calling require.context() to call requireContext() instead. Which eliminated the TypeError, but what does this solve, because webpack will be looking for require.context()?
Also, when I put this line in my startup file:
require('require-context/register');
I got strange errors like this one from other modules:
path.js:39
throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type function
at assertPath (path.js:39:11)
at Object.isAbsolute (path.js:404:5)
With 6000 downloads a week, somebody is clearly getting value from this module, but for the life of me I can't figure it out.
Thanks,
Eric
from require-context.
I'm not sure what you are asking - can you give me an example of exactly what you are trying to do?
Thanks!
from require-context.
Related Issues (12)
- Let causes syntax problems in Karma tests HOT 1
- How can I exclude a directory?
- Trailing Slash Beheads Key
- License
- Using variable for directory doesn't work
- unexpected behaviour using relative path as a first argument of requireContext
- I'd like to take over the repository
- allow dangerous support for multiple directories? HOT 1
- empty folder causes error HOT 4
- no such file or directory HOT 1
- Depth level support.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from require-context.