Error: _mergeDefaults is not defined (in ^1.0)
Một pull request liên quan đã được merge.
- #328 của @Teages — đã merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- nuxtjs, typescript
- Lĩnh vực
- build-system
Hướng nghiên cứu
Bắt đầu với bản tái hiện nuxt-module-builder-issue được liên kết và so sánh prepack playground path với dev:prepare. Kiểm tra mã component được tạo xung quanh propDefaults đã import và lời gọi _mergeDefaults; hoàn thành khi published-module path không còn tạo ra một helper undefined và vẫn giữ nguyên các giá trị mặc định của prop đã import.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I updated a module to use 1.0 and kept getting this error when actually using it. Version 0.8 works fine. Managed to replicate the issue, here's the repo (prepack + dev playground). Note I set the playground to link the parent module and use it as if it were a real dep, otherwise I can't replicate. In a real app, using a real published module I can also replicate.
Interestingly, using dev:prepare does not have the same issue.
The issue happens if a component imports an object and uses it as the defaults for a prop, the outputted code looks like this:
<script setup>
import { propDefaults } from "./defaults.js";
defineProps(/* @__PURE__ */ _mergeDefaults({
color: { type: String, required: false },
disabled: { type: Boolean, required: false }
}, {
color: "blue",
...propDefaults
}));
</script>
If I remove propDefaults, because withDefaults is transformed away it works:
defineProps({
color: { type: String, required: false, default: "blue" },
disabled: { type: Boolean, required: false, default: false }
});
With 0.8 it used to just looked like this and worked fine:
<script setup lang="ts">
import { propDefaults } from './defaults.js'
withDefaults(defineProps<{
color?: string
disabled?: boolean
}>(), {
color: 'blue',
...propDefaults,
})
</script>
I know component's can't reference local objects because withDefaults is a compiler macro, but they can reference imports like this. Or at least, this had been working fine for me for a long time and I checked and it works fine on the Vue SFC playground too.
- Ngôn ngữ chính
- TypeScript
- Star
- 277
- Fork
- 36
- Merge trung bình
- 4 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nuxt/module-builder
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
nuxt/module-builder#801 ·
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
nuxt/module-builder#764 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
nuxt/module-builder#754 ·
-
Conflict between folder structure in readme (src/runtime) and TypeScript config (src/module/runtime)Có thể đã có người làm @dword-design đã nhận 137 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
nuxt/module-builder#749 ·
-
Tsdown/obuild migrationCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
nuxt/module-builder#726 · 1 bình luận · 1 reaction ·
Tất cả issue của nuxt/module-builder
Issue tương tự
-
bug priority: P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
mattermost/compass-design#106 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openclaw/openclaw#176671 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
nordcraftengine/nordcraft#1400 ·
Maintainer thường phản hồi trong vòng 1 ngày