Home > Web Front-end > Vue.js > body text

Error reported in vue3+vite: Module 'path' has been externalized for How to deal with it

PHPz
Release: 2023-05-14 13:40:13
forward
2963 people have browsed it

Foreword:

Handling of error messages encountered by vue3 vite. Error message:

Uncaught (in promise) Error: Module "path" has been externalized for browser compatibility. Cannot access "path.resolve" in client code.

Error reported in vue3+vite: Module path has been externalized for How to deal with it

Reason for the error:

Specifically, for browser compatibility, the path module cannot be used in client code

Handling method:

1. Download path- browserify

npm install path-browserify --save
Copy after login

2. Modify the introduction method:

import path from 'path' Modify to:

import path from 'path-browserify'
Copy after login

The above is the detailed content of Error reported in vue3+vite: Module 'path' has been externalized for How to deal with it. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template