add esm only

This commit is contained in:
DefectingCat
2022-09-30 09:44:12 +08:00
parent 5f104f011d
commit f1eca69d16
5 changed files with 71 additions and 10 deletions

View File

@ -22,11 +22,13 @@ const isExport = process.env.NEXT_BUILD === 'export';
const nextConfig = {
/* config options here */
reactStrictMode: true,
swcMinify: true,
output: 'standalone',
images: isExport ? { unoptimized: true } : {},
experimental: {
// runtime: 'nodejs',
// outputStandalone: true,
esmExternals: true,
},
// assetPrefix: isExport ? './' : undefined,
// images:

View File

@ -32,7 +32,10 @@
"rehype-slug": "^5.0.1",
"remark-frontmatter": "^4.0.1",
"remark-gfm": "^3.0.1",
"sharp": "^0.31.0"
"rua-three": "^1.0.5",
"sharp": "^0.31.0",
"stats.js": "^0.17.0",
"three": "^0.145.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
@ -40,6 +43,8 @@
"@types/jest": "^29.1.0",
"@types/node": "18.7.23",
"@types/react": "18.0.21",
"@types/stats.js": "^0.17.0",
"@types/three": "^0.144.0",
"autoprefixer": "^10.4.12",
"cross-env": "^7.0.3",
"dotenv": "^16.0.2",

View File

@ -2,13 +2,23 @@ import cn from 'classnames';
import dynamic from 'next/dynamic';
import Head from 'next/head';
import { useState } from 'react';
import { InitFn, useThree } from 'rua-three';
import style from 'styles/index/index.module.css';
import type { NextPageWithLayout } from 'types';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
const MainLayout = dynamic(() => import('layouts/MainLayout'));
const init: InitFn = ({ scene, camera }) => {
camera.position.set(0, 5, 5);
};
console.log(OrbitControls);
const Home: NextPageWithLayout = () => {
const [showLang, setShowLang] = useState(false);
const { ref } = useThree({
init,
});
return (
<>
@ -20,7 +30,9 @@ const Home: NextPageWithLayout = () => {
<div className="z-0 w-full max-w-3xl px-4 my-4 text-2xl">
<div className="max-w-xl leading-10">
<h1 className="pb-4 text-4xl">Hi there 👋, I&apos;m Arthur. </h1>
<p>I&apos;m a Front-end developer. Yes, that&apos;s mean</p>
{/* <canvas ref={ref}></canvas> */}
{/* <p>I&apos;m a Front-end developer. Yes, that&apos;s mean</p>
<p
onMouseOver={() => setShowLang(true)}
onMouseLeave={() => setShowLang(false)}
@ -51,7 +63,7 @@ const Home: NextPageWithLayout = () => {
</p>
<p>
Open source is my passion. It&apos;s making everything be great.{' '}
</p>
</p> */}
</div>
</div>
</main>

View File

@ -1,8 +1,12 @@
{
"compilerOptions": {
"baseUrl": ".",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@ -15,8 +19,14 @@
"isolatedModules": true,
"jsx": "preserve",
// "typeRoots": ["./types", "./node_modules/@types"],
"incremental": true
"incremental": true,
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}

View File

@ -2038,6 +2038,11 @@
resolved "https://registry.npmmirror.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"
integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==
"@types/stats.js@^0.17.0":
version "0.17.0"
resolved "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.0.tgz#0ed81d48e03b590c24da85540c1d952077a9fe20"
integrity sha512-9w+a7bR8PeB0dCT/HBULU2fMqf6BAzvKbxFboYhmDtDkKPiyXYbjoe2auwsXlEFI7CFNMF1dCv3dFH5Poy9R1w==
"@types/testing-library__jest-dom@^5.9.1":
version "5.14.3"
resolved "https://registry.npmmirror.com/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.3.tgz#ee6c7ffe9f8595882ee7bda8af33ae7b8789ef17"
@ -2045,6 +2050,13 @@
dependencies:
"@types/jest" "*"
"@types/three@^0.144.0":
version "0.144.0"
resolved "https://registry.npmjs.org/@types/three/-/three-0.144.0.tgz#a154f40122dbc3668c5424a5373f3965c6564557"
integrity sha512-psvEs6q5rLN50jUYZ3D4pZMfxTbdt3A243blt0my7/NcL6chaCZpHe2csbCtx0SOD9fI/XnF3wnVUAYZGqCSYg==
dependencies:
"@types/webxr" "*"
"@types/tough-cookie@*":
version "4.0.2"
resolved "https://registry.npmmirror.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397"
@ -2060,6 +2072,11 @@
resolved "https://registry.npmmirror.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==
"@types/webxr@*":
version "0.5.0"
resolved "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.0.tgz#aae1cef3210d88fd4204f8c33385a0bbc4da07c9"
integrity sha512-IUMDPSXnYIbEO2IereEFcgcqfDREOgmbGqtrMpVPpACTU6pltYLwHgVkrnYv0XhWEcjio9sYEfIEzgn3c7nDqA==
"@types/yargs-parser@*":
version "21.0.0"
resolved "https://registry.npmmirror.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b"
@ -7744,6 +7761,11 @@ rimraf@^3.0.2:
dependencies:
glob "^7.1.3"
rua-three@^1.0.5:
version "1.0.5"
resolved "https://registry.npmjs.org/rua-three/-/rua-three-1.0.5.tgz#a726d7472e964cb63b3897861aeeac4f5b78bb9f"
integrity sha512-a9N2y7Pyq4R1gsa9KRbNvUX6mrY5B3w9NuqUuzvzO32+u9tdC+LwAwqC26s8Inhd34gB12N2INQGk55rR0i0PQ==
run-async@^2.4.0:
version "2.4.1"
resolved "https://registry.npmmirror.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455"
@ -8012,6 +8034,11 @@ stack-utils@^2.0.3:
dependencies:
escape-string-regexp "^2.0.0"
stats.js@^0.17.0:
version "0.17.0"
resolved "https://registry.npmjs.org/stats.js/-/stats.js-0.17.0.tgz#b1c3dc46d94498b578b7fd3985b81ace7131cc7d"
integrity sha512-hNKz8phvYLPEcRkeG1rsGmV5ChMjKDAWU7/OJJdDErPBNChQXxCo3WZurGpnWc6gZhAzEPFad1aVgyOANH1sMw==
string-length@^4.0.1:
version "4.0.2"
resolved "https://registry.npmmirror.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a"
@ -8328,6 +8355,11 @@ textextensions@2:
resolved "https://registry.npmmirror.com/textextensions/-/textextensions-2.6.0.tgz#d7e4ab13fe54e32e08873be40d51b74229b00fc4"
integrity sha512-49WtAWS+tcsy93dRt6P0P3AMD2m5PvXRhuEA0kaXos5ZLlujtYmpmFsB+QvWUSxE1ZsstmYXfQ7L40+EcQgpAQ==
three@^0.145.0:
version "0.145.0"
resolved "https://registry.npmjs.org/three/-/three-0.145.0.tgz#a613d71e75effc2aed88be630027ca01e2b6502e"
integrity sha512-EKoHQEtEJ4CB6b2BGMBgLZrfwLjXcSUfoI/MiIXUuRpeYsfK5aPWbYhdtIVWOH+x6X0TouldHKHBuc/LAiFzAw==
through@^2.3.6:
version "2.3.8"
resolved "https://registry.npmmirror.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"