Use in Next JS throws SyntaxError when configuring boiler-plate #1880
rasmusfredrik
started this conversation in
General
Replies: 2 comments 15 replies
-
Nextjs relies on Node which expects commonjs dependencies. Threejs is written in ES6, so you'll have to either transpile it yourself with iirc, Next 12 supports modules OOTB, but I'd look at the official starter for reference. |
Beta Was this translation helpful? Give feedback.
8 replies
-
I hope I understand your question correctly, so here are the steps to reproduce.
|
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I hope this is the right place to ask a question / report a problem.
The setup is Next JS running @react-three/fiber as follows:
import { Canvas, useLoader } from '@react-three/fiber'
import { TextureLoader } from 'three/src/loaders/TextureLoader'
Then the TextureLoader is initialised as follows:
const cloud = useLoader(TextureLoader, './textures/cloud.png')
At runtime the SyntaxError appears as:
import { ImageLoader } from './ImageLoader.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
Have not been able to find a solution to this issue anywhere.
Does anyone have any knowledge of how to tackle this problem and can help?
Beta Was this translation helpful? Give feedback.
All reactions