Not using node.js : Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../" - 卑面派对 - 博客园Not using node.js : Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../" - 卑面派对 - 博客园方法一
- parcel
npm install -g parcel-bundler
parcel *.html
方法二
html文章来源地址https://www.toymoban.com/news/detail-594951.html
<head>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.138.0/build/three.module.js",
"OrbitControls": "https://unpkg.com/three@0.138.0/examples/jsm/controls/OrbitControls.js"
}
}
</script>
</head>
<body>
<script type="module" src="js/test.js"></script>
</body>
// test.js
import * as THREE from 'three';
import { OrbitControls } from 'OrbitControls';
scene = new THREE.Scene();
renderer = new THREE.WebGLRenderer();
controls = new OrbitControls(camera, renderer.domElement);
文章来源:https://www.toymoban.com/news/detail-594951.html
到了这里,关于Not using node.js : Uncaught TypeError: Failed to resolve module specifier “three“. Relative referen的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!