We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm importing the modules "fs" and "os" in this file
// Third-Party libraries import ytdl from 'ytdl-core' // Utils import { getVideoTitle } from '@/utils/youtube' // NodeJS import fs from 'fs' import os from 'os' // i18n import { getJson } from '@/i18n/utils' // Types import type { Language } from '@/types/language' import type { OS } from '@/types/os.d' // Constants import { DOWNLOAD_FORMAT_FILTERS, DownloadQuality } from '@/constants/download' import { FileExtensions, UTF8_ENCODING } from '@/constants/files' // Utils import { cleanInvalidChars } from '@/utils/chars' interface DownloadControllerProps { url: string downloadVideo: boolean language: Language userOS: OS } interface DownloadControllerResult { success: boolean errorMessage?: string responseMessage?: string } export async function downloadController({ url, downloadVideo, language, userOS }: DownloadControllerProps): Promise<DownloadControllerResult> { const { download } = getJson(language) try { const originalTitle = await getVideoTitle(url) const titleWithOutInvalidChars = cleanInvalidChars({ title: originalTitle, userOS }) const extension = FileExtensions[downloadVideo ? 'Video' : 'Audio'] const userDesktop = `${os.homedir()}/desktop` ytdl(url, { filter: DOWNLOAD_FORMAT_FILTERS[downloadVideo ? 'video' : 'audio'], quality: DownloadQuality[downloadVideo ? 'Video' : 'Audio'] }).pipe( fs.createWriteStream( `${userDesktop}/${titleWithOutInvalidChars}.${extension}`, { encoding: UTF8_ENCODING } ) ) return { success: true, responseMessage: download.success } } catch (error) { console.error(error) return { success: false, errorMessage: download.errors.couldNotBeDownloaded } } }
And when I pull up the development server it gives me this error
Here's my Astro configuration
// Astro import { defineConfig } from 'astro/config' // Integrations import sitemap from '@astrojs/sitemap' import solidJs from '@astrojs/solid-js' import tailwind from '@astrojs/tailwind' import vercel from '@astrojs/vercel/serverless' // Vite plugins import { nodePolyfills } from 'vite-plugin-node-polyfills' // https://astro.build/config export default defineConfig({ integrations: [tailwind(), solidJs(), sitemap()], site: 'https://easyviewer.vercel.app', output: 'server', adapter: vercel({ webAnalytics: { enabled: true } }), i18n: { defaultLocale: 'es', locales: ['es', 'en'], routing: { prefixDefaultLocale: false } }, vite: { plugins: [ nodePolyfills({ include: ['fs', 'os'] }) ] } })
The text was updated successfully, but these errors were encountered:
Similar issue but referencing crypto. A workaround that seems to work is excluding it:
import { sveltekit } from '@sveltejs/kit/vite' import { defineConfig } from 'vitest/config' import { nodePolyfills } from 'vite-plugin-node-polyfills' export default defineConfig({ plugins: [ sveltekit(), nodePolyfills({ // WORKAROUND: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/90 exclude: ['crypto'] }) ], test: { include: ['src/**/*.{test,spec}.{js,ts}'] } })
Sorry, something went wrong.
It worked, I just had to exclude crypto to solve the error.
crypto
exports is not defined
No branches or pull requests
I'm importing the modules "fs" and "os" in this file
And when I pull up the development server it gives me this error
Here's my Astro configuration
The text was updated successfully, but these errors were encountered: