Skip to content

ERROR: self is not defined #169

@bennidi

Description

@bennidi

I am getting this error when trying to run your example (using node v16.15.0) and "type"="module"

ReferenceError: self is not defined at Object.<anonymous> (/Users/bdiedrichsen/dev/sources/laboratory/deskone/node_modules/svg-to-excalidraw/dist/bundle.js:1:242) ....

Something is not right with the bundling. I found this link https://stackoverflow.com/questions/64639839/typescript-webpack-library-generates-referenceerror-self-is-not-defined
and tried to replace self with this in the code. It went along and produced other errors about things not defined.
I tried checking out the repo and changing the globalObject to this but I just get the next error ReferenceError: DOMParser is not defined.

I think your library is not built to be used in non-browser environments.
Which is a pitty because I wanted to integrate it with Kit. It would be a great tool for creating library elements from desktop workflow.

Maybe you are interested in producing a version that can be run in node environment?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions