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.

build Error:Could not resolve './use-prevent-globalThis' from ./use-prevent-globalThis?commonjs-external

See original GitHub issue

Environment


  • Operating System: Linux
  • Node Version: v14.18.0
  • Nuxt Version: 3-3.0.0-27235989.d52b1e8
  • Package Manager: Yarn
  • Bundler: Vite
  • User Config: meta, alias, css, vite
  • Runtime Modules: -
  • Build Modules: -

Describe the bug

build error Could not resolve './use-prevent-globalThis' from ./use-prevent-globalThis?commonjs-external

image

Reproduction

https://github.com/element-plus/element-plus-nuxt-starter 这个项目在我这边build也报同样错误

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
keithchincommented, Oct 14, 2021

Same issue here.

Screenshot 2021-10-14 at 4 59 59 PM
1reaction
danielroecommented, Apr 13, 2022

@nachtfunke Yes, exactly. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

globalThis - JavaScript - MDN Web Docs
The global globalThis property contains the global this value, which is usually akin to the global object.
Read more >
Why can you redefine globalThis and global but not window?
In your case, since globalThis is configurable, you get false (so no error), but as window isn't configurable, HasRestrictedGlobalProperty ...
Read more >
Bundling with Rollup - Vue.js 3 Course
commonjs (extension .cjs.js , for use with node.js) ... This would make the user be stuck on the version of Vue we provide...
Read more >
A horrifying globalThis polyfill in universal JavaScript
Note that in JavaScript modules, there is a module scope intervening between the global scope and your code. The module scope hides the...
Read more >
rollup/plugin-commonjs - npm.io
This can throw at build time if there is no default export. This is how external dependencies are handled when esmExternals is not...
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