Im struggling to get a simple three.js website running on a live server (a2 shared hosting). Ive installed node.js. The start up file is main.js but it doesn't seem to be able to read it. Im completely new to working with Node. When I start the server I get this error. Im totally lost...
/home/blockc17/app/main.js:1
import './style.css';
^^^^^^^^^^^^^
SyntaxError: Unexpected string
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at Module.require (/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-
scripts/node-loader.js:80:25)
at require (internal/modules/cjs/helpers.js:25:18)
at loadApplication (/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-
scripts/node-loader.js:243:2)
at setupEnvironment (/opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-
scripts/node-loader.js:214:2)
**Main.js imports**
import './style.css';
import * as THREE from 'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
// Setup
**package.json**
{
"name": "blockcb",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"vite": "^2.8.0"
}
}
**Index.html HEAD**
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="module" src="./src/main.js"></script>
<title>BlockChain Bullies</title>
</head>
Forgive me for dumping so much code. Im not sure of the best way to even approach this issue. Can anyone give me guidance on how to get this app running?
[file structure in Cpanel][1]
[1]: https://i.stack.imgur.com/lYiX7.png
you need use vite to process the css import. just run
yarn dev