Kalan's Blog

Software Engineer / Taiwanese / Life in Fukuoka

Current Theme light

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.

Prev

Svelte Notes (1) - No Silver Bullet

Next

How to record video using XCode Simulator

If you found this article helpful, please consider buy me a drink ☕️ It'll make my ordinary day shine✨

Buy me a coffee

作者

Kalan 頭像照片,在淡水拍攝,淺藍背景

愷開 | Kalan

Hi, I'm Kai. I'm Taiwanese and moved to Japan in 2019 for work. Currently settled in Fukuoka. In addition to being familiar with frontend development, I also have experience in IoT, app development, backend, and electronics. Recently, I started playing electric guitar! Feel free to contact me via email for consultations or collaborations or music! I hope to connect with more people through this blog.