Did the latest @sapphire/[email protected] update break things?

Super preliminary stuff because I haven't bothered to debug it thoroughly; It seems like the plugin doesn't import in my logs after running pnpm update. The typings for the i18n entry in SapphireClient also disappeared. Reverting to 5.0.4 seems to fix the issue. Has anyone else encountered this?
17 Replies
Favna
Favna16mo ago
The only change is what is mentioned in #Announcements but make sure you're not yet on i18next v23
some1chan
some1chanOP16mo ago
I did install i18next (latest, so v23) because I didn't know what I was doing. promptly uninstalled it when I realized I should be going through the plugin to interact with i18next. wonder if that's causing really weird problems, maybe because of pnpm? deleting node_modules, and installing via npm doesn't seem to have worked (according to tsc) also can't find any references to i18next@23 in pnpm-lock.yaml nor the package-lock.json file that was just created
Favna
Favna16mo ago
you do need to install i18next but v22
some1chan
some1chanOP16mo ago
oh huh installing it separately seems to work! the TypeScript complier still seems to complain however about i18n being an unknown key in ClientOptions, though
Favna
Favna16mo ago
make sure you call the /register somewhere in your code
some1chan
some1chanOP16mo ago
import '@sapphire/plugin-i18next/register' i presume qualifies, in my setup.ts? which setup.ts gets imported as the first line in my index.ts throwing random thoughts because I seem to see the replies super duper late; I'm also using ESM, not sure if that matters here I still have typings for other plugins (although I haven't really tested if they even work at all, like i18next) like the API and I believe unofficial Sentry plugin
Favna
Favna16mo ago
what's your TS version? and are you using @sapphire/ts-config?
Favna
Favna16mo ago
I think you may have the same issue as https://github.com/sapphiredev/plugins/pull/471 but as I said there too, I cannot reproduce the issue.
GitHub
fix(i18next): Fix augments by Swiizyy · Pull Request #471 · sapphir...
Repair of module de Declarations that do not work after the last update.
Swiizyy
Swiizyy16mo ago
check, but I thought I had them too, but in the end I had no resolutions for the modules I updated, so I switched to the 'Node16' resolution module, which allowed me to find everything again.
Favna
Favna16mo ago
which is a TS 5.2 issue and will be fixed with @sapphire/ts-config v5 which I linked on your PR
some1chan
some1chanOP16mo ago
oop, yeah im using TS 5.2. Currently using my own (ish) ts-config, think it had to do with trying to make TypeScript work with ESM
{
"compilerOptions": {
// Basic Options
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"baseUrl": "src",
"rootDir": "src",
"outDir": "dist",

// Comes from (mostly) @sapphire/ts-config
// NOTE: I'm pretty sure I edited this from the base config shown on the npmjs README; specifically the node resolution stuff
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"declaration": true,
"declarationMap": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"importHelpers": true,
"verbatimModuleSyntax": true,
"incremental": true,
"moduleResolution": "Node",
"newLine": "lf",
"noEmitHelpers": false,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"pretty": true,
"removeComments": false,
// "resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"useDefineForClassFields": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
}
{
"compilerOptions": {
// Basic Options
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"baseUrl": "src",
"rootDir": "src",
"outDir": "dist",

// Comes from (mostly) @sapphire/ts-config
// NOTE: I'm pretty sure I edited this from the base config shown on the npmjs README; specifically the node resolution stuff
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"declaration": true,
"declarationMap": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"importHelpers": true,
"verbatimModuleSyntax": true,
"incremental": true,
"moduleResolution": "Node",
"newLine": "lf",
"noEmitHelpers": false,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"pretty": true,
"removeComments": false,
// "resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"useDefineForClassFields": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
}
maybe also personal preference and/or debugging trying to figure out how to copy over my localization files from src/ into dist/ (ended up using a custom script, not sure how else rn). I think it was also why i18next (i think even with the 5.0.4 version) with HMR working sporatically? (i dont think it works anymore, either so maybe fixing this helps) the sporatic behavior also be my custom script not copying files correctly though, but prolly doesn't explain it not working at all now
Favna
Favna16mo ago
Set module and moduleResolution to node16. moduleResolution Node is also called Node10, NodeJS 10 compatible. Not ESM. Add src/**/*.json to your includes. And add the resolveJsonModules compiler option
some1chan
some1chanOP16mo ago
at least for plugin-i18next, this seems to have worked! It also seems to have broken the hack I forgot I used to get typings for SentryOptions in '@kaname-png/plugin-sentry' it looked somewhat like this:
// setup.ts
import type { SentryOptions } from '@kaname-png/plugin-sentry/dist/lib/types';
// ...
declare module '@sapphire/framework' {
interface SapphireClientOptions {
sentry?: { options?: SentryOptions };
}
}
// setup.ts
import type { SentryOptions } from '@kaname-png/plugin-sentry/dist/lib/types';
// ...
declare module '@sapphire/framework' {
interface SapphireClientOptions {
sentry?: { options?: SentryOptions };
}
}
Favna
Favna16mo ago
For kaname's plugins you'll need him: @sawa_ko. The idea with community plugins is that you'll have to ask the creator for support. But looking at that I'd say Kaname needs to fix his export mapping
some1chan
some1chanOP16mo ago
seems to not have done anything, which puzzles me. just to double check, this would be correct?
...
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"useDefineForClassFields": true
},
"include": ["src/**/*", "src/**/*.json"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
}
...
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"useDefineForClassFields": true
},
"include": ["src/**/*", "src/**/*.json"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
}
oh wait a sec nvm, it did work! probably forgot to rerun with "resolveJsonModule": true i believe also fyi; i can't seem to mark this as the answer, as the Apps context menu isn't there. is that intended if I don't want to have the posts on answer overflow?
Favna
Favna16mo ago
discord client bug
Favna
Favna16mo ago
because there is supposed to be many options
No description
Want results from more Discord servers?
Add your server