Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-request 从2.0.0-rc.4版本更新到 2.0.1之后 webpack打包出现错误。 #199

Closed
hihumiW opened this issue Jun 2, 2023 · 4 comments
Labels
2.x 2.x bug Something isn't working question Further information is requested

Comments

@hihumiW
Copy link

hihumiW commented Jun 2, 2023

问题描述 Problem Description

首先很感谢作者提供library!
vue-request 从2.0.0-rc.4版本更新到 2.0.1之后 webpack打包出现错误。

项目环境:项目是用vue-cli-service搭建的, 项目携带的webpack版本是4.46.0。
安装2.0.1打包时报错信息:

Failed to compile with 1 error                                                                                                                12:15:31 PM

 error  in ./node_modules/vue-request/dist/index.es.js

Module parse failed: Unexpected token (23:40)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| const isServer = typeof window === 'undefined';
| const isDocumentVisibility = () => {
>   if (isServer || isNil(window.document?.visibilityState)) return true;
|   return window.document.visibilityState === 'visible';
| };

 @ ./src/main.js 12:18-40
 @ multi (webpack)-dev-server/client?http://192.168.0.78:1024&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

如果使用2.0.0-rc.4则不会报错。
我对比了一下2个版本的同一行代码,问题应该出现在webpack无法解析 optional chaining: ?.
请问一下是因为我的webpack版本太老导致的吗?

其他信息 Other information

@hihumiW hihumiW added the question Further information is requested label Jun 2, 2023
@John60676
Copy link
Member

下午会重新发个包

@John60676 John60676 added bug Something isn't working 2.x 2.x labels Jun 2, 2023
@John60676
Copy link
Member

v2.0.2 已发布

@hihumiW
Copy link
Author

hihumiW commented Jun 5, 2023

v2.0.2 已发布

大佬麻烦在看一下:npm上目前只能获取到2.0.1的包
image

@John60676
Copy link
Member

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x 2.x bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants