1abb9ed080
* chore: unvendor vite * chore: upgrade vue and svelte * feat(renderer-solid): upgrade for vite@2.7.x * chore: update yarn.lock * fix(solid): upgrade solid renderer for vite@2.7.x * test: improve css test * chore: upgrade to vite@2.8.0-beta.3 * fix: replace hacky serialization with 'serialize-javascript' * fix: externalize serialize-javascript * fix: explicitly add execa@6.x.x to devDependencies * test(css): skip css?url test * chore: update vite-plugin-svelte * fix: ssr option * chore: update changeset * chore: remove changeset * chore: add changeset * chore: add back missing changeset * chore: update vite * chore: update to latest vite * test: update proload? * chore: update dependencies * fix: remove preact from nanostores example * fix: update static-build-pkg to use `.mjs` extension * fix: exclude './server.js' from custom-elements test * chore: remove unused file
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
export default {
|
|
name: '@astrojs/renderer-solid',
|
|
client: './client.js',
|
|
server: './server.js',
|
|
jsxImportSource: 'solid-js',
|
|
jsxTransformOptions: async ({ ssr }) => {
|
|
const [{ default: solid }] = await Promise.all([import('babel-preset-solid')]);
|
|
const options = {
|
|
presets: [solid({}, { generate: ssr ? 'ssr' : 'dom', hydratable: true })],
|
|
plugins: [],
|
|
};
|
|
|
|
return options;
|
|
},
|
|
viteConfig(options) {
|
|
// https://github.com/solidjs/vite-plugin-solid
|
|
|
|
// We inject the dev mode only if the user explicitely wants it or if we are in dev (serve) mode
|
|
const replaceDev = options.mode === 'development' || options.command === 'serve';
|
|
|
|
const nestedDeps = ['solid-js', 'solid-js/web', 'solid-js/store', 'solid-js/html', 'solid-js/h'];
|
|
|
|
return {
|
|
/**
|
|
* We only need esbuild on .ts or .js files.
|
|
* .tsx & .jsx files are handled by us
|
|
*/
|
|
esbuild: { include: /\.ts$/ },
|
|
resolve: {
|
|
conditions: ['solid', ...(replaceDev ? ['development'] : [])],
|
|
dedupe: nestedDeps,
|
|
alias: [{ find: /^solid-refresh$/, replacement: '/@solid-refresh' }],
|
|
},
|
|
optimizeDeps: {
|
|
include: nestedDeps,
|
|
exclude: ['@astrojs/renderer-solid/server.js'],
|
|
},
|
|
ssr: {
|
|
external: ['babel-preset-solid'],
|
|
},
|
|
};
|
|
},
|
|
};
|