Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(bridge): Recognize {... as default } construction in vite plugin #1769

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bridge/src/vite/plugins/default-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PREFIX = 'defaultexport:'
const hasPrefix = (id: string = '') => id.startsWith(PREFIX)
const removePrefix = (id: string = '') => hasPrefix(id) ? id.substr(PREFIX.length) : id

const hasDefaultExport = (code: string = '') => code.includes('export default')
const hasDefaultExport = (code: string = '') => code.match(/export (default|.* as default)/g)
const addDefaultExport = (code: string = '') => code + '\n\n' + 'export default () => {}'

export function defaultExportPlugin () {
Expand Down