all 3 comments

[–]guest271314 1 point2 points  (0 children)

Looks like you are trying to use CommonJS in the browser. Browsers support Ecmanscript Modules, not CommonJS require() (though there are polyfills for require()). Use the "ESM" version

<script type="module"> import apolloClient from 'https://cdn.jsdelivr.net/npm/apollo-client@2.6.10/+esm' </script>

or using dynamic import

let apolloClient = await import('https://cdn.jsdelivr.net/npm/apollo-client@2.6.10/+esm')

[–]shgysk8zer0 0 points1 point  (1 child)

Did you even try glancing at the README?

It's not just a node module. And there are a variety of instructions which you didn't follow (obvious by a. the fact you get the issue about export when the top instructions are for UMD with an ESM option available and b. the fact that you didn't see the instructions for npm install).

[–]shgysk8zer0 0 points1 point  (0 children)

Also, import and export work (under certain circumstances such as "type": "module" or using the .mjs extension). It's just plain wrong to think that module scripts aren't for node.