astro/packages/renderers/renderer-solid/index.js
Nate Moore 19d45496e7 [next] Update renderers (#1509)
* chore: update vite

* fix(renderers): point renderers to resolved server/client entrypoints
2021-10-15 14:10:26 -06:00

31 lines
1,008 B
JavaScript

export default {
name: '@astrojs/renderer-solid',
client: './client.js',
server: './server.js',
external: ['solid-js/web/dist/server.js', 'solid-js/store/dist/server.js', 'solid-js/dist/server.js', 'babel-preset-solid'],
knownEntrypoints: ['solid-js', 'solid-js/web', 'solid-js/store', 'solid-js/html', 'solid-js/h'],
jsxImportSource: 'solid-js',
jsxTransformOptions: async ({ isSSR }) => {
const [{ default: solid }] = await Promise.all([import('babel-preset-solid')]);
const options = {
presets: [solid({}, { generate: isSSR ? 'ssr' : 'dom', hydratable: true })],
plugins: [],
};
if (isSSR) {
options.plugins.push([
'babel-plugin-module-resolver',
{
cwd: process.cwd(),
alias: {
'solid-js': 'solid-js/dist/server.js',
'solid-js/store': 'solid-js/store/dist/server.js',
'solid-js/web': 'solid-js/web/dist/server.js',
},
},
]);
}
return options;
},
};