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

quokka throws error with for an esm only library #855

Closed
bhvngt opened this issue Jan 17, 2023 · 1 comment
Closed

quokka throws error with for an esm only library #855

bhvngt opened this issue Jan 17, 2023 · 1 comment

Comments

@bhvngt
Copy link

bhvngt commented Jan 17, 2023

Issue description or question

I am facing an issue when I am using quokka with modern-errors. It runs fine with node cli. These library is esm only library

Is this issue related to Quokka not outputting the expected results of your code?: Yes

Sample code

import ModernError from "modern-errors";

export const InvalidInputError = ModernError.subclass('InvalidInputError', {
    custom: class extends ModernError {
        #schemaId;
        constructor(message, options, schemaId) {
            super(message, options);
            this.#schemaId = schemaId;
        }
        get schemaId() {return this.#schemaId}
    }
})

const error = new InvalidInputError('Wrong user name', {}, "schema/1.0.0")

console.log(`error.message`, error.schemaId);

Sample repository link

bhvngt/modern-error-quokka

Quokka.js Console Output

test.js (node: v18.13.0)

"new InvalidInputError()" must not be directly called.
This error class should be created like this instead:
  export const InvalidInputError = custom.subclass('InvalidInputError')
	at validateSubclass ./node_modules/.pnpm/modern-errors@5.5.0/node_modules/modern-errors/build/src/subclass/validate.js:21
	at new ModernError ./node_modules/.pnpm/modern-errors@5.5.0/node_modules/modern-errors/build/src/main.js:26
	at new custom src/test.js:7:12
	at new InvalidInputError ./node_modules/.pnpm/modern-errors@5.5.0/node_modules/modern-errors/build/src/subclass/custom.js:21
	at src/test.js:14:0

Code editor version

Intellij: 2022.3.1

OS name and version

OSX

@smcenlly
Copy link
Member

Thanks for reporting the problem. We have found and fixed the issue.

Please update to the latest version of Quokka, it should now work for you.

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

2 participants