I wanted to try using Svelte with GraphQL to see how it feels. The Observable Query provided by Apollo is very easy to use in reactive scenarios.
In my Svelte project, I imported ApolloClient
:
import ApolloClient from 'apollo-boost';
But after installing everything, I found that the Rollup compilation failed with the following error:
[!] Error: 'import' and 'export' may only appear at the top level
node_modules/symbol-observable/es/index.js (2:0)
1: /* global window */
2: import ponyfill from './ponyfill.js';
^
3:
4: var root;
Error: 'import' and 'export' may only appear at the top level
at error (/Users/kalan/code/github-tool/node_modules/rollup/dist/shared/node-entry.js:5400:30)
at Module.error (/Users/kalan/code/github-tool/node_modules/rollup/dist/shared/node-entry.js:9824:16)
at tryParse (/Users/kalan/code/github-tool/node_modules/rollup/dist/shared/node-entry.js:9717:23)
at Module.setSource (/Users/kalan/code/github-tool/node_modules/rollup/dist/shared/node-entry.js:10080:33)
at Promise.resolve.catch.then.then.then (/Users/kalan/code/github-tool/node_modules/rollup/dist/shared/node-entry.js:12366:20)
I looked up the issue and found that similar problems exist in other places as well. I'm currently too lazy to continue searching for a solution because I have other ideas that I want to complete first. So, I have to go back to my comfort zone and continue using React. I'll make a note of this for future reference.