question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: __webpack_require__(...).context is not a function

See original GitHub issue

Version

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:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
mekkanixcommented, Jul 17, 2019

Seriously you are on an english-based community, you cannot speak in english, please? It may be useful for other devs reading you.

3reactions
papa-zulucommented, Aug 26, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found