Skip to content
New issue

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

ReferenceError #74

Closed
Jacknq opened this issue Feb 8, 2023 · 1 comment
Closed

ReferenceError #74

Jacknq opened this issue Feb 8, 2023 · 1 comment

Comments

@Jacknq
Copy link

Jacknq commented Feb 8, 2023

Im getting,
node 18.3
typescript 4.9.4
vite 4.0.4-4.1.1

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

ReferenceError: Cannot access '__vite_ssr_import_2__' before initialization
    at eval (/src/api/methods/file.ts:7:13)
    at async instantiateModule

I dont have any circular dependencies, checked by plugin and I do strictnullchecks=false is tsconfig

//node_modules/vite/dist/node/chunks/dep-5e7f419b.js:52225:9)
 try {
        // eslint-disable-next-line @typescript-eslint/no-empty-function
        const AsyncFunction = async function () { }.constructor;
        const initModule = new AsyncFunction(`global`, ssrModuleExportsKey, ssrImportMetaKey, ssrImportKey, ssrDynamicImportKey, ssrExportAllKey, '"use strict";' + result.code + `\n//# sourceURL=${mod.url}`);
     
        await initModule(context.global, ssrModule, ssrImportMeta, ssrImport, ssrDynamicImport, ssrExportAll); //HERE
    }
@Jacknq
Copy link
Author

Jacknq commented Feb 13, 2023

Its possible that it has something to do with vitest and vite in dev both referenced in project json using different versions of vite..
What i did was removing vite reference completely and using only vitest and vite-plugin-node reference while using (and calling) vite thats coming with vitest package. Its weird, but this config seems to work.

@Jacknq Jacknq closed this as completed Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant