. Advertisement .
..3..
. Advertisement .
..4..
Hello, everyone. I am doing a Svelte project. I got a error message when I establish my project with a library of a 3rd party. Below is the error:
Terminal
1: /* global window */
2: import ponyfill from './ponyfill.js';
^
3:
4: var root;
Error: 'import' and 'export' may only appear at the top level
If everyone has any solutions to deal with, please share them with me. Thanks!!!
The cause:
You get the above error because you use
@rollup/plugin-commonjs
version. This version 11.1.0 gets a bug.Solution:
You have to downgrade the module library version. It means to downgrade
@rollup/plugin-commonjs
version to version 11.0.2. And then, you only run the command in the terminal.That is my suggestion. I hope it will help you to solve the error you get. Good luck!!!