question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use import statement outside a module

See original GitHub issue

If you are using server side rendering, you might run into the following

...\node_modules\react-sliding-pane\dist\react-sliding-pane.js:1
import React from 'react';
^^^^^^

SyntaxError: Cannot use import statement outside a module

to solve, in your babel config edit it to

require("@babel/register")({ ignore: [ // /(node_module)/ //This right here! Now it will throw babel error, but it will not crash server ],

Probably a way to solve this issue using babel to compile react-sliding-pane so that it will not throw this error when running.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DimitryDushkincommented, Jul 8, 2020

Made 5.0 release https://www.npmjs.com/package/react-sliding-pane please try. It worked for me within CRA.

1reaction
DimitryDushkincommented, Jul 8, 2020

That is because package is not providing CommonJS exports. I’ll fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Uncaught SyntaxError: Cannot use import statement outside ...
This means that you're using the native source code in an unaltered/unbundled state, leading to the following error: Uncaught SyntaxError: ...
Read more >
Cannot use import statement outside a module [React ...
When building a web application, you may encounter the SyntaxError: Cannot use import statement outside a module error.
Read more >
How to fix "cannot use import statement outside a module"
I stumbled on this error: Uncaught SyntaxError: cannot use import statement outside a module while importing a function from a JavaScript ...
Read more >
How to solve: cannot use import statement outside a module
When you see the error message Uncaught SyntaxError: cannot use import statement outside a module, it means you're using an import statement ......
Read more >
SyntaxError: Cannot use import statement outside a module
If you are using node application and want to use the import statement, then you will also get the " Cannot use import...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found