From d5932cff0ee8acb03c4812eb147d2cf8bdf3082c Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 7 Apr 2022 13:21:56 -0400 Subject: [PATCH] Allow an adapter to export default (#3022) * Allow an adapter to export default * Adds a changeset --- src/core/build/vite-plugin-ssr.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/build/vite-plugin-ssr.ts b/src/core/build/vite-plugin-ssr.ts index 93c53b99bc95..723703cd1fb1 100644 --- a/src/core/build/vite-plugin-ssr.ts +++ b/src/core/build/vite-plugin-ssr.ts @@ -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')} ` : '' }