Skip to content

Commit

Permalink
Allow an adapter to export default (withastro#3022)
Browse files Browse the repository at this point in the history
* Allow an adapter to export default

* Adds a changeset
  • Loading branch information
matthewp committed Apr 7, 2022
1 parent fb4a2bc commit d5932cf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/build/vite-plugin-ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ const _args = ${adapter.args ? JSON.stringify(adapter.args) : 'undefined'};
${
adapter.exports
? `const _exports = adapter.createExports(_manifest, _args);
${adapter.exports.map((name) => `export const ${name} = _exports['${name}'];`).join('\n')}
${adapter.exports.includes('_default') ? `export default _default` : ''}
${adapter.exports.map((name) => {
if(name === 'default') {
return `const _default = _exports['default'];
export { _default as default };`;
} else {
return `export const ${name} = _exports['${name}'];`
}
}).join('\n')}
`
: ''
}
Expand Down

0 comments on commit d5932cf

Please sign in to comment.