I got an error
var req = require.context(path.join(ROOT, "src/pages"), false, /^\.\/.*\.js$/);
^
TypeError: require.context is not a function
and I am on [email protected] [email protected]
Any idea on how to resolve this?
Thanks,
Hao
Can you provide a little test case? It's easier to figure out what's going on that way.
Why does that seem that you are trying to use require.context
in an unbundled file?
Basically, did you compile your code or did you try running it raw? webPack does not modify require
at all - it only transpiles it's usage within the bundle during compilation.
Would be nice if you could provide a bit more detail on your scene. :)
require.context(path.join(ROOT, "src/pages"),
You can't use an expression as first argument to require.context. It must be a compile-time constant string.
Most helpful comment
You can't use an expression as first argument to require.context. It must be a compile-time constant string.