Closed kpopovic closed 2 years ago
The last time I used it in an app, the Winston package did some really wild stuff that made it impossible to bundle. I'd suggest moving it to a prod dependency of your app.
prod dependency
Hello,
the "same" thing also happens with mysql2 package...
"devDependencies": {
"@fontsource/fira-mono": "^4.5.0",
"@neoconfetti/svelte": "^1.0.0",
"@sveltejs/adapter-auto": "next",
"@sveltejs/adapter-node": "*",
"@sveltejs/kit": "next",
"@types/cookie": "^0.5.1",
"knex": "^2.3.0",
"mysql2": "^2.3.3",
"prettier": "^2.6.2",
"prettier-plugin-svelte": "^2.7.0",
"svelte": "^3.46.0",
"svelte-check": "^2.7.1",
"typescript": "^4.7.4",
"vite": "^3.1.0"
},
'better-sqlite3' is imported by better-sqlite3?commonjs-external, but could not be resolved – treating it as an external dependency 'tedious' is imported by tedious?commonjs-external, but could not be resolved – treating it as an external dependency 'mysql' is imported by mysql?commonjs-external, but could not be resolved – treating it as an external dependency 'oracledb' is imported by oracledb?commonjs-external, but could not be resolved – treating it as an external dependency 'pg' is imported by pg?commonjs-external, but could not be resolved – treating it as an external dependency 'pg-query-stream' is imported by pg-query-stream?commonjs-external, but could not be resolved – treating it as an external dependency 'sqlite3' is imported by sqlite3?commonjs-external, but could not be resolved – treating it as an external dependency Circular dependency: node_modules/mysql2/index.js -> node_modules/mysql2/lib/connection.js -> node_modules/mysql2/promise.js -> node_modules/mysql2/index.js Circular dependency: node_modules/mysql2/index.js -> node_modules/mysql2/lib/pool.js -> node_modules/mysql2/index.js Circular dependency: node_modules/mysql2/index.js -> node_modules/mysql2/lib/pool.js -> node_modules/mysql2/lib/pool_connection.js -> node_modules/mysql2/index.js ✔ done
when I add all "missing" dependencies, at the end I get also ** string_decoder/' is not supported.
@Conduitry Now it seams to work, I have placed winston packages to prod dependency section. Will try it also for mysql2 dependency to see will it also work.
{ "name": "kit-template-default", "version": "0.0.1", "scripts": { "dev": "vite dev", "build": "vite build", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch", "lint": "prettier --plugin-search-dir . --check .", "format": "prettier --plugin-search-dir . --write ." }, "devDependencies": { "@fontsource/fira-mono": "^4.5.0", "@neoconfetti/svelte": "^1.0.0", "@sveltejs/adapter-auto": "next", "@sveltejs/adapter-node": "*", "@sveltejs/kit": "next", "@types/cookie": "^0.5.1", "jose": "^4.10.0", "luxon": "^3.0.4", "prettier": "^2.6.2", "prettier-plugin-svelte": "^2.7.0", "svelte": "^3.46.0", "svelte-check": "^2.7.1", "typescript": "^4.7.4", "vite": "^3.1.0" }, "type": "module", "dependencies": { "winston": "^3.8.2", "winston-daily-rotate-file": "^4.7.1" } }
@Conduitry I confirm that mysql2 package is also build properly when placed to prod dependency in package.json file. How to know then when to place dependency to dev or prod section ? Just to check if buildwith adapter-node works or not ?
@kpopovic we do not handle questions or support via github bugs. please start a discussion or ask on https://svelte.dev/chat in #questions
Closing here as putting winston
in pkg.dependencies is the proper way to do it.
Describe the bug
Hello,
when
import * as winston from 'winston';
is imported the app breaks because of string_decoder/' is not supported error. Is winston possible to be used in sveltekit ? How to configure it? Is any logging npm package which writes logs to file possible to use in sveltekit ?Reproduction
stackblitz example
Logs
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response