Magick
Magick

Reputation: 5132

Svelte: Uncaught ReferenceError: exports is not defined

Background

I am trying to use dgraph-js-http in a Svelte application.

Error

The initial error I was facing was:

Uncaught ReferenceError: buffer is not defined
    <anonymous> http://localhost:5000/build/bundle.js:6947

I'm including this as maybe my solution to this was not the best, and that hopefully there is a way to solve both this issue, and the current blocker issue.

However, after a trial-and-error approach (see below for the various things I've tried) I'm now stuck.

Current error

After solving the above error, I am now blocked on this error:

Uncaught ReferenceError: define is not defined

Attempts to resolve

None of the following have worked.

Uncaught ReferenceError: exports is not defined

Upvotes: 8

Views: 1093

Answers (1)

Exonnix Kai
Exonnix Kai

Reputation: 11

I think you missed type: "module" attribute in package.json. Here, the type attribute represents whether the type of javascript interpreter is commonjs or babel. type: "module" indicates that you are going to use babel as the ECMA script interpreter.

Upvotes: 1

Related Questions