Uncaught TypeError: __webpack_require__(...).context is not a function
See original GitHub issueVersion
3.6.0
Environment info
vue 2.6.0 @vue/cli-service 3.6.0
Steps to reproduce
js文件中使用 require.context (webpack提供)浏览器 出现__webpack_require__(…).context is not a function (require.context is not function ) 同样 require.ensure 也不可用
What is expected?
require.context 可用
What is actually happening?
require.context 不可用
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Uncaught TypeError: __webpack_require__(…).context is not ...
Try changing the third argument from a string to a regex, ie: const components = require.context('./', true, /^index.js$/).
Read more >TypeError: require.context is not a function · Issue #2487
Issue details If you use require. context within a React component the storyshots will fail with TypeError: require. context is not a function...
Read more >How to resolve “TypeError: require.context is not a function” in ...
While we were writing Jest tests, we ran into an the error “TypeError: require.context is not a function”. This is because of the...
Read more >Dependency Management - webpack
You can create your own context with the require.context() function. It allows you to pass in a directory to search, a flag indicating...
Read more >__webpack_require__ is not a function - You.com | The ...
TypeError : __webpack_require__.i (...) is not a function ... Since core is a folder of your app and not an npm module, Webpack...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seriously you are on an english-based community, you cannot speak in english, please? It may be useful for other devs reading you.
What @itlangzi tried to say there is that the path parameter has to be a literal regex and can’t be passed via variable. You can read more about this in another issue here: https://github.com/webpack/webpack/issues/9300#issuecomment-524744609