Skip to content

Commit

Permalink
Fix(Nuxt): Nuxt module build
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Jan 15, 2024
1 parent 6271324 commit 0ca205e
Show file tree
Hide file tree
Showing 4 changed files with 453 additions and 3,678 deletions.
4 changes: 2 additions & 2 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@master/css.nuxt",
"scripts": {
"build": "nuxt-module-build build",
"dev": "nuxi dev playground",
"build": "nuxt-module-build prepare && nuxt-module-build build",
"dev": "nuxt-module-build prepare && nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
"lint": "eslint .",
Expand Down
7 changes: 4 additions & 3 deletions packages/nuxt/src/runtime/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { render } from '@master/css-server'
import type { NitroApp } from 'nitropack'
import exploreConfig from 'explore-config'
// @ts-expect-error virtual module
// @ts-ignore
import pluginOptions from '#master-css-nuxt-plugin-options'
// @ts-expect-error virtual module
// @ts-ignore
import nuxtOptions from '#nuxt-options'

export default ((nitro: NitroApp) => {
const config = exploreConfig(pluginOptions.config ?? 'master.css.*', { cwd: nuxtOptions.srcDir })
// @ts-ignore
const config = exploreConfig['default'](pluginOptions.config ?? 'master.css.*', { cwd: nuxtOptions.srcDir })
nitro.hooks.hook('render:response', async (response) => {
if (typeof response.body === 'string' && (response.headers?.['Content-Type'] || response.headers?.['content-type'])?.includes('html')) {
const { html } = render(response.body, config)
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "./.nuxt/tsconfig.json"
}
"extends": "./.nuxt/tsconfig.json"
}
Loading

0 comments on commit 0ca205e

Please sign in to comment.