ArunMichaelDsouza / ArunMichaelDsouza/react-image-appear

Cannot use import statement outside a module

Open
#29 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
271
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Hello, I'm creating a blog with React / Next.js.
The problem below occurred when loading images. Is there any idea to solve this?

Error message:
```bash
/path/to/node_modules/react-image-appear/src/ReactImageAppear.js:7
import React, { Component } from 'react';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.react-image-appear (/path/to/.next/server/pages/blog.js:751:18)
at __webpack_require__ (/path/to/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./src/pages/blog/index.tsx:12:76)
at Object../src/pages/blog/index.tsx (/path/to/.next/server/pages/blog.js:535:1)
at __webpack_require__ (/path/to/.next/server/webpack-runtime.js:33:42)
at __webpack_exec__ (/path/to/.next/server/pages/blog.js:815:52)
at /path/to/.next/server/pages/blog.js:816:28
at Object. (/path/to/.next/server/pages/blog.js:819:3)
at Module._compile (internal/modules/cjs/loader.js:999:30)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/ReactImageAppear.js and the src/pages/blog/index.tsx import shown in the stack trace; reproduce the failure while loading an image in the Next.js blog. Check how the package is consumed during server rendering, with done defined as the page loading images without the module syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.