Installations
npm install import-three-examples
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
9.10.1
NPM Version
6.9.0
Score
72.5
Supply Chain
98.9
Quality
76
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
xiongtongzi
Download Statistics
Total Downloads
19,738
Last Day
5
Last Week
32
Last Month
128
Last Year
1,716
GitHub Statistics
100 Stars
50 Commits
7 Forks
4 Watchers
1 Branches
4 Contributors
Updated on Mar 05, 2024
Bundle Size
10.41 kB
Minified
2.73 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.2.4
Package Id
import-three-examples@2.2.4
Unpacked Size
33.78 kB
Size
8.13 kB
File Count
30
NPM Version
6.9.0
Node Version
9.10.1
Total Downloads
Cumulative downloads
Total Downloads
19,738
Last Day
150%
5
Compared to previous day
Last Week
60%
32
Compared to previous week
Last Month
64.1%
128
Compared to previous month
Last Year
-47.3%
1,716
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads

No dependencies detected.
import-three-examples
this is webpack plugin, It was created to solve the problem of threeJs modular development.
不会额外增大打包之后得文件体积!原项目webpack结构无需改动!
no big!no change!
npm i imports-loader exports-loader --save-dev
npm i import-three-examples --save-dev
国内用户如果npm下载卡住,请更换成cnpm下载
webpack config
const ThreeExamples = require('import-three-examples')
module.exports = {
......
......
module: {
rules: [
......
......
{
test: /\.js$/,
loader: 'babel-loader'
},
...ThreeExamples
]
}
}
render page/js
import OrbitControls from "three/examples/js/controls/OrbitControls"
import FBXLoader from "three/examples/js/loaders/FBXLoader"
......
......
let controls = new OrbitControls(camera, el)
let fbx = new FBXLoader()
fbx.load(url, function (_obj) {
console.log(_obj)
})
......
......
2019/01/11 vue-cli 3.0+ 的webpack配置:
vue.config.js
const ThreeExamples = require('import-three-examples')
module.exports = {
chainWebpack: config => {
ThreeExamples.forEach((v) => {
if (~v.use.indexOf('imports')) {
config.module
.rule(`${v.test}_i`)
.test(require.resolve(v.test))
.use(v.use)
.loader(v.use)
} else {
config.module
.rule(`${v.test}_e`)
.test(require.resolve(v.test))
.use(v.use)
.loader(v.use)
}
})
}
}
2019/01/17 nuxt 中的配置
nuxt.config.js
const ThreeExamples = require('import-three-examples')
module.exports = {
build: {
extend(config, ctx) {
ThreeExamples.forEach((v, i) => {
config.module.rules.push({
test: require.resolve(v.test.split('node_modules\\')[1]),
use: v.use
})
})
}
}
}
2019/03/08 说明一下(仅针对webpack不太熟的童靴)
最近很多人反馈这个插件怎么不起作用啊
结果都是因为引入了本地模型,但是未对模型设置webpack加载器
下面用fbx和obj模型作为例子,教大家怎么对模型设置webpack加载器。其他格式的模型/.(fbx|obj)$/中的fbx和obj替换成你们需要的模型,多种格式间用 | 衔接
首先一定要cnpm i url-loader --save-dev (如果模型太大可以使用flie-loader)!!!!!!!!!!
本地的静态资源我建议是最好用import引入,再不济也需要用require(),直接写相对路径如果不熟悉webpack配置很容易造成dev静态资源引入正常但build资源却404
webpack
同样是在module.rules 中添加
{
test: /\.(fbx|obj)$/,
loader: 'url-loader'
},
(下面就是最上面对应的引入插件的方法)
vue-cli 3.0
vue.config.js
const ThreeExamples = require('import-three-examples')
module.exports = {
chainWebpack: config => {
config.module
.rule('obj')
.test(/\.(fbx|obj)$/)
.use('file-loader')
.loader('file-loader')
(下面就是最上面对应的引入插件的方法)
}
}
nuxt 3.0
extend(config, ctx) {
config.module.rules.push( {
test: /\.(fbx|obj)(\?.*)?$/,
loader: 'url-loader',
})
(下面就是最上面对应的引入插件的方法)
}
2019/03/13 关于引入LegacyJSONLoader的问题
直接引入LegacyJSONLoader加载json格式的模型,会报错让THREE.ObjectLoader
直接使用THREE.ObjectLoader,又会报错需要LegacyJSONLoader来帮加载某个对象
结果看了源码,需要'THREE' in window && 'LegacyJSONLoader' in THREE 才行
解决办法如下
window.THREE = {}
import * as THREE from 'imports-loader?THREE\.LegacyJSONLoader=three/examples/js/loaders/deprecated/LegacyJSONLoader!three'
var loader = new THREE.ObjectLoader();
loader.load(url, (o) => {
console.log(o)
});

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.6
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More