kontent-ai / delivery-sdk-js

Kontent Delivery SDK for Javascript
https://kontent.ai
MIT License
50 stars 34 forks source link

Uncaught ReferenceError: exports is not defined #44

Closed Tungamirai closed 6 years ago

Tungamirai commented 6 years ago

Getting an error Uncaught ReferenceError: exports is not defined

at line

Object.defineProperty(exports, "__esModule", { value: true }); var kentico_cloud_delivery_typescript_sdk_1 = require("kentico-cloud-delivery-typescript-sdk");

Enngage commented 6 years ago

Hi,

Can you share more details as how you are using the SDK and in what environment? The error you are receiving is often related to using CommonJS while not having it installed. See this question.

Enngage commented 6 years ago

This also sound like the type of when you would be using the 'js' library directly in your browser. Browsers however do not currently have a support for CommonJs module. For that you need to use tool such as Browserfiy to resolve the modules. You can see exmaple of this in our sample Javascript app as well.

Tungamirai commented 6 years ago

@Enngage Hi Thanks for the answer , that was the problem i was trying run it straight in the browser :0 ... ended up using webpack to bundle it first

Enngage commented 6 years ago

Awesome, thanks for letting me know :-)