Skip to content

Commit

Permalink
fix: error -d
Browse files Browse the repository at this point in the history
  • Loading branch information
arpowers committed Mar 21, 2024
1 parent fba54c4 commit f6ea91a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion @fiction/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@iconify-json/logos": "^1.1.42",
"@iconify-json/tabler": "^1.1.109",
"@medv/finder": "^3.2.0",
"@sinclair/typebox": "^0.32.17",
"@sinclair/typebox": "^0.32.18",
"@slack/webhook": "^7.0.2",
"@tailwindcss/container-queries": "^0.1.1",
"@unhead/schema": "^1.8.20",
Expand Down
25 changes: 14 additions & 11 deletions @fiction/core/plugin-app/plugin-render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,20 @@ export class FictionRender extends FictionPlugin<FictionRenderSettings> {
const appViteConfigFile = await this.getAppViteConfigFile()

const twPlugin = getRequire()('tailwindcss') as typeof tailwindcss
const { visualizer } = await import('rollup-plugin-visualizer')

const twConfig = (await this.getTailwindConfig()) as Parameters<typeof twPlugin>[0]

const plugins = [
pluginVue(),
...getMarkdownPlugins({ isProd, distClient: this.distFolderClient }),
unocss({ presets: [presetIcons()], safelist: [] }),
]

if (isProd) {
const { visualizer } = await import('rollup-plugin-visualizer')
plugins.unshift(visualizer({ filename: `stats.html`, emitFile: true }))
}

let merge: vite.InlineConfig[] = [
commonVite || {},
{
Expand All @@ -189,13 +200,7 @@ export class FictionRender extends FictionPlugin<FictionRenderSettings> {
],
},
},
server: {},
plugins: [
visualizer({ filename: `stats.html`, emitFile: true }),
pluginVue(),
...getMarkdownPlugins({ isProd, distClient: this.distFolderClient }),
unocss({ presets: [presetIcons()], safelist: [] }),
],
plugins,
resolve: {
alias: [
...this.getStaticPathAliases({ mainFilePath: this.fictionEnv.mainFilePath }),
Expand All @@ -215,12 +220,10 @@ export class FictionRender extends FictionPlugin<FictionRenderSettings> {
serverRenderHtml = async (params: types.RenderConfig): Promise<string> => {
const { pathname = '/', template, isProd, runVars = {} } = params

const viteServer = await this.getViteServer({ isProd })

const ssr = new SSR({
appUrl: this.fictionApp.appUrl.value,
distFolderServerMountFile: this.distFolderServerMountFile,
viteServer,
viteServer: !isProd ? await this.getViteServer({ isProd }) : undefined,
mountFilePath: this.mountFilePath,
})

Expand Down
5 changes: 4 additions & 1 deletion @fiction/core/plugin-app/render/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type SSRSettings = {
appUrl: string
distFolderServerMountFile: string
mountFilePath: string
viteServer: ViteDevServer
viteServer?: ViteDevServer
}

export class SSR extends FictionObject<SSRSettings> {
Expand Down Expand Up @@ -93,6 +93,9 @@ export class SSR extends FictionObject<SSRSettings> {
async renderDev(args: { pathname: string, runVars: Partial<RunVars> }): Promise<RenderedHtmlParts> {
const { pathname, runVars } = args

if (!this.settings.viteServer)
throw new Error('renderDev: ViteDevServer not found')

const entryModule = await this.settings.viteServer.ssrLoadModule(this.settings.mountFilePath)

const out = this.getParts({ pathname, runVars, entryModule })
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f6ea91a

Please sign in to comment.