Amrit
Amrit
NNuxt
Created by Amrit on 4/12/2024 in #❓・help
Installing module from npm causes does not provide an export named 'default' issue
Alright so I ended up placing it in the module.ts file setup function and it works!
_nuxt.options.vite.optimizeDeps ||= {}
_nuxt.options.vite.optimizeDeps.include ||= []

// Ensure we transform these cjs dependencies, remove as they get converted to ejs
_nuxt.options.vite.optimizeDeps.include.push('debug')
_nuxt.options.vite.optimizeDeps ||= {}
_nuxt.options.vite.optimizeDeps.include ||= []

// Ensure we transform these cjs dependencies, remove as they get converted to ejs
_nuxt.options.vite.optimizeDeps.include.push('debug')
6 replies
NNuxt
Created by Amrit on 4/12/2024 in #❓・help
Installing module from npm causes does not provide an export named 'default' issue
hmm maybe the issue is actually that vite is not optimizing this dependency
6 replies
NNuxt
Created by Amrit on 4/12/2024 in #❓・help
Installing module from npm causes does not provide an export named 'default' issue
So it looks like I need to use build.config.ts, though not quite sure what I'm missing here
import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
stubOptions: { jiti: { debug: true, transformModules: ["debug"] } },
});
import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
stubOptions: { jiti: { debug: true, transformModules: ["debug"] } },
});
if I set stub:true it works, but all my paths become hard paths from my machine. Is there any way to avoid that? Maybe this belongs under unjs?
6 replies
NNuxt
Created by Amrit on 4/12/2024 in #❓・help
Installing module from npm causes does not provide an export named 'default' issue
6 replies
NNuxt
Created by Amrit on 4/12/2024 in #❓・help
Installing module from npm causes does not provide an export named 'default' issue
Adding the module code here:
import {
addComponent,
addPlugin,
createResolver,
defineNuxtModule,
extendPages,
} from '@nuxt/kit'

import type { Configuration } from './types'

// Module options TypeScript interface definition
export type ModuleOptions = Configuration

export default defineNuxtModule<ModuleOptions>({
meta: {
name: '@scalar/nuxt',
configKey: 'scalarConfig',
},
// Default configuration options of the Nuxt module
defaults: {
darkMode: true,
metaData: {
title: 'API Documentation by Scalar',
},
pathRouting: {
basePath: '/scalar',
},
showSidebar: true,
},
setup(_options, _nuxt) {
const resolver = createResolver(import.meta.url)
let isOpenApiEnabled = false

// Ensure we transpile api-reference css
_nuxt.options.build.transpile.push('@scalar/api-reference')

// Also check for Nitro OpenAPI auto generation
_nuxt.hook('nitro:config', (config) => {
if (config.experimental?.openAPI) isOpenApiEnabled = true
})

// Load the component so it can be used directly
addComponent({
name: 'ScalarApiReference',
export: 'default',
filePath: resolver.resolve('./runtime/components/ScalarApiReference.vue'),
})

// Add the route for the docs
extendPages((pages) => {
pages.push({
name: 'scalar',
path: _options.pathRouting?.basePath + ':pathMatch(.*)*',
meta: {
configuration: _options,
isOpenApiEnabled,
},
file: resolver.resolve('./runtime/pages/ScalarPage.vue'),
})
})

// Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
addPlugin(resolver.resolve('./runtime/plugins/hydrateClient'))
},
})
import {
addComponent,
addPlugin,
createResolver,
defineNuxtModule,
extendPages,
} from '@nuxt/kit'

import type { Configuration } from './types'

// Module options TypeScript interface definition
export type ModuleOptions = Configuration

export default defineNuxtModule<ModuleOptions>({
meta: {
name: '@scalar/nuxt',
configKey: 'scalarConfig',
},
// Default configuration options of the Nuxt module
defaults: {
darkMode: true,
metaData: {
title: 'API Documentation by Scalar',
},
pathRouting: {
basePath: '/scalar',
},
showSidebar: true,
},
setup(_options, _nuxt) {
const resolver = createResolver(import.meta.url)
let isOpenApiEnabled = false

// Ensure we transpile api-reference css
_nuxt.options.build.transpile.push('@scalar/api-reference')

// Also check for Nitro OpenAPI auto generation
_nuxt.hook('nitro:config', (config) => {
if (config.experimental?.openAPI) isOpenApiEnabled = true
})

// Load the component so it can be used directly
addComponent({
name: 'ScalarApiReference',
export: 'default',
filePath: resolver.resolve('./runtime/components/ScalarApiReference.vue'),
})

// Add the route for the docs
extendPages((pages) => {
pages.push({
name: 'scalar',
path: _options.pathRouting?.basePath + ':pathMatch(.*)*',
meta: {
configuration: _options,
isOpenApiEnabled,
},
file: resolver.resolve('./runtime/pages/ScalarPage.vue'),
})
})

// Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
addPlugin(resolver.resolve('./runtime/plugins/hydrateClient'))
},
})
6 replies
RRailway
Created by Shah on 2/28/2023 in #✋|help
How to use a reverse proxy with railway
Just came to say I was trying to use nginx for a reverse proxy as well for a similar use case. Ended up trying out caddy and it worked on the first try. Many thanks!
100 replies