Discussions

Ask a Question
Back to All

Does Sprig JavaScript SDK work in ReactJS Web application?

I installed the SDK using yarn and I added this to one of the components:

import { sprig } from '@sprig-technologies/sprig-browser';

const Sprig = sprig.configure({
  environmentId: '<OUR ID>',
});

But I am getting errors:

- error Error [ReferenceError]: window is not defined
    at file:/frontend-web/node_modules/@sprig-technologies/sprig-browser/dist/index-IMQ1RWe8.js:209:1
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:429:15) {
  digest: undefined
}

Please help