-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing nuxt module build error (#452)
* using createResolver * fixing issue with importing vite config from @explorer-1/vue
- Loading branch information
1 parent
edbf1cf
commit 428feed
Showing
14 changed files
with
501 additions
and
2,405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as _nuxt_schema from '@nuxt/schema'; | ||
|
||
interface ModuleOptions { | ||
includeStyles: boolean; | ||
includeComponents: boolean; | ||
} | ||
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>; | ||
|
||
export { type ModuleOptions, _default as default }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
export * from "/Users/smithste/repos/explorer-1/packages/nuxt/src/module"; | ||
export { default } from "/Users/smithste/repos/explorer-1/packages/nuxt/src/module"; | ||
import * as _nuxt_schema from '@nuxt/schema'; | ||
|
||
interface ModuleOptions { | ||
includeStyles: boolean; | ||
includeComponents: boolean; | ||
} | ||
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>; | ||
|
||
export { type ModuleOptions, _default as default }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,51 @@ | ||
import jiti from "file:///Users/smithste/repos/explorer-1/node_modules/.pnpm/jiti@1.21.0/node_modules/jiti/lib/index.js"; | ||
import { defineNuxtModule, createResolver, installModule, addComponentsDir } from '@nuxt/kit'; | ||
|
||
/** @type {import("/Users/smithste/repos/explorer-1/packages/nuxt/src/module")} */ | ||
const _module = jiti(null, { | ||
"esmResolve": true, | ||
"interopDefault": true, | ||
"alias": { | ||
"@explorer-1/nuxt": "/Users/smithste/repos/explorer-1/packages/nuxt" | ||
const module = defineNuxtModule({ | ||
meta: { | ||
name: "@explorer-1/nuxt", | ||
configKey: "explorer1" | ||
}, | ||
// Default configuration options of the Nuxt module | ||
defaults: { | ||
includeStyles: true, | ||
includeComponents: true | ||
}, | ||
async setup(_options, _nuxt) { | ||
const resolver = createResolver(import.meta.url); | ||
const runtimeDir = resolver.resolve("./runtime"); | ||
if (_options.includeStyles) { | ||
await installModule("@nuxtjs/tailwindcss", { | ||
configPath: resolver.resolve(runtimeDir, "tailwind.config") | ||
}); | ||
_nuxt.options.css.push( | ||
resolver.resolve("./../node_modules/@explorer-1/vue/src/assets/scss/", "styles.scss") | ||
); | ||
_nuxt.options.postcss = { | ||
plugins: { | ||
autoprefixer: {} | ||
} | ||
}; | ||
_nuxt.options.vite = { | ||
..._nuxt.options.vite, | ||
css: { | ||
..._nuxt.options.css, | ||
preprocessorOptions: { | ||
scss: { | ||
additionalData: `@import "@explorer-1/common/src/scss/_hover.scss";` | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
if (_options.includeComponents) { | ||
addComponentsDir({ | ||
path: resolver.resolve("./../node_modules/@explorer-1/vue/src/components"), | ||
global: true, | ||
pathPrefix: false, | ||
extensions: [".vue"] | ||
}); | ||
} | ||
} | ||
})("/Users/smithste/repos/explorer-1/packages/nuxt/src/module.ts"); | ||
}); | ||
|
||
export default _module; | ||
export { module as default }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
declare const _default: { | ||
content: string[]; | ||
mode: string; | ||
darkMode: "class"; | ||
theme: Partial<import("../../../common/node_modules/tailwindcss/types/config").CustomThemeConfig>; | ||
plugins: any[]; | ||
future: { | ||
hoverOnlyWhenSupported: true; | ||
}; | ||
safelist: string[]; | ||
}; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { createResolver } from '@nuxt/kit' | ||
import explorer1Config from '@explorer-1/common/tailwind.config' | ||
|
||
console.log('ℹ Tailwind Config provided by @explorer-1/nuxt') | ||
|
||
const resolver = createResolver(import.meta.url) | ||
|
||
export default { | ||
...explorer1Config, | ||
content: [resolver.resolve('./../../node_modules/@explorer-1/vue/src/**/*.vue')] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
|
||
import type { ModuleOptions, ModuleHooks, ModuleRuntimeHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module.js' | ||
import type { ModuleOptions } from './module.js' | ||
|
||
declare module '#app' { | ||
interface RuntimeNuxtHooks extends ModuleRuntimeHooks {} | ||
} | ||
|
||
declare module '@nuxt/schema' { | ||
interface NuxtConfig { ['explorer1']?: Partial<ModuleOptions> } | ||
interface NuxtOptions { ['explorer1']?: ModuleOptions } | ||
interface NuxtHooks extends ModuleHooks {} | ||
interface RuntimeConfig extends ModuleRuntimeConfig {} | ||
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {} | ||
} | ||
|
||
declare module 'nuxt/schema' { | ||
interface NuxtConfig { ['explorer1']?: Partial<ModuleOptions> } | ||
interface NuxtOptions { ['explorer1']?: ModuleOptions } | ||
interface NuxtHooks extends ModuleHooks {} | ||
interface RuntimeConfig extends ModuleRuntimeConfig {} | ||
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {} | ||
} | ||
|
||
|
||
export type { default } from './module.js' | ||
export type { ModuleOptions, default } from './module.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
|
||
import type { ModuleOptions, ModuleHooks, ModuleRuntimeHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module' | ||
import type { ModuleOptions } from './module' | ||
|
||
declare module '#app' { | ||
interface RuntimeNuxtHooks extends ModuleRuntimeHooks {} | ||
} | ||
|
||
declare module '@nuxt/schema' { | ||
interface NuxtConfig { ['explorer1']?: Partial<ModuleOptions> } | ||
interface NuxtOptions { ['explorer1']?: ModuleOptions } | ||
interface NuxtHooks extends ModuleHooks {} | ||
interface RuntimeConfig extends ModuleRuntimeConfig {} | ||
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {} | ||
} | ||
|
||
declare module 'nuxt/schema' { | ||
interface NuxtConfig { ['explorer1']?: Partial<ModuleOptions> } | ||
interface NuxtOptions { ['explorer1']?: ModuleOptions } | ||
interface NuxtHooks extends ModuleHooks {} | ||
interface RuntimeConfig extends ModuleRuntimeConfig {} | ||
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {} | ||
} | ||
|
||
|
||
export type { default } from './module' | ||
export type { ModuleOptions, default } from './module' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import path from 'path' | ||
import { fileURLToPath } from 'node:url' | ||
import { createResolver } from '@nuxt/kit' | ||
import explorer1Config from '@explorer-1/common/tailwind.config' | ||
|
||
// mimic CommonJS variables -- not needed if using CommonJS | ||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = path.dirname(__filename) | ||
|
||
console.log('ℹ Tailwind Config provided by @explorer-1/nuxt') | ||
|
||
const resolver = createResolver(import.meta.url) | ||
|
||
export default { | ||
...explorer1Config, | ||
content: [path.resolve(__dirname, './../../node_modules/@explorer-1/vue/src/**/*.vue')] | ||
content: [resolver.resolve('./../../node_modules/@explorer-1/vue/src/**/*.vue')] | ||
} |
Oops, something went wrong.