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

Commit

Permalink
Recognize {... as default } construction in vite plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez authored Nov 7, 2021
1 parent 104d3e3 commit d30170e
Showing 1 changed file with 1 addition and 1 deletion.
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

0 comments on commit d30170e

Please sign in to comment.