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

【已定位】使用export default导出时热重载与发行不一致问题 #5254

Open
Shxuuer opened this issue Dec 13, 2024 · 0 comments

Comments

@Shxuuer
Copy link

Shxuuer commented Dec 13, 2024

项目结构如下
Project
├─ static
│ └─ const.js
└─components
└─ Test.vue

const.js代码

export default {}

Test.vue

<script>
import test from '../static/const.js"
<script>

当第一次编译项目或发行时,会出现找不到test的问题,但热编译后正常

经过排查问题,第一次编译或发行时,const,js被编译为

export default {}

但热编译后const.js被编译为

"use strict"
const test ={}
exports.test=test;

将const.js改为

export const test =  {}

后解决问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant