ThreeJS-Webpack-ES6-Boilerplate

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 谭刚毅
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Three.js Webpack ES6 Boilerplate

https://github.com/paulmg/ThreeJS-Webpack-ES6-Boilerplate/

A basic boilerplate for a Three.js project including the use of Webpack and ES6 syntax via Babel.

Project Structure

build - Directory for built and compressed files from the npm build script
src - Directory for all dev files
├── css - Contains all SCSS files, that are compiled to `src/public/css`
├── js - All the Three.js app files, with `app.js` as entry point. Compiled to `src/public/js` with webpack
│   ├── app
│   │   ├── components - Three.js components that get initialized in `main.js`
│   │   ├── helpers - Classes that provide ideas on how to set up and work with defaults
│   │   ├── managers - Manage complex tasks such as GUI or input
│   │   └── model - Classes that set up the model object
│   ├── data - Any data to be imported into app
│   └── utils - Various helpers and vendor classes
└── public - Used by webpack-dev-server to serve content. Webpack builds local dev files here. 
    └── assets - Is copied over to build folder with build command. Place external asset files here.

Getting started

Install dependencies:

npm install

Then run dev script:

npm run dev

Spins up a webpack dev server at localhost:8080 and keeps track of all js and sass changes to files.

Build

npm run build

Cleans existing build folder while linting js folder and copies over the public assets folder from src. Then sets environment to production and compiles js and css into build.

Other NPM Scripts

You can run any of these individually if you'd like with the npm run command:

  • prebuild - Cleans up build folder and lints src/js
  • clean - Cleans build folder
  • lint - Runs lint on the src/js folder and uses the .eslintrc file in root for linting rules
  • webpack-server - Start up a webpack-dev-server with hot-module-replacement
  • webpack-watch - Run webpack in dev environment with watch
  • dev:js - Run webpack in dev environment without watch
  • build:dir - Copy files and folders from src/public to build
  • build:js - Run webpack in production environment

Input Controls

  • Press H to hide dat.GUI
  • Arrow controls will pan
  • Mouse left click will rotate/right click will pan
  • Scroll wheel zooms in and out
  • module.exports和exports是属于commonJs规范 export和export default是ES6模块规范 commonjs模块输出的是值的浅拷贝,输出后被改变,其他引用模块不会改变 同步 存在本地硬盘,加载快 node.js 运行时加载 浏览器不支持 ES6模块输出的是值的引用 (输出后被改变,其他引用模块会改变) 编译时输出接口 webpack的tree-shaking

  • 概况 webpack 是代码编译工具,有入口、出口、loader 和插件。(核心部分:入口和出口) webpack 是一个用于现代 JavaScript 应用程序的静态模块打包工具。 当 webpack 处理应用程序时,它会在内部构建一个依赖图(dependency graph),此依赖图对应映射到项目所需的每个模块,并生成一个或多个 bundle。 主要功能【=>打包=》自动化配置全自动的执行我

  • 在这里理清一下以上几个概念以及他们之间的关系。 现在的浏览器很多都不支持es6的语法,或者仅仅是部分支持,比如你用.360浏览器,你会发现它支持let却不支持箭头函数等。 babel就承担了“翻译”的角色,把es6的写法转换成es5的写法。 但是有些人可能在一个项目中单独安装完babel,并成功生成了新的文件后,发现导入这个文件到浏览器中却报错了。其中很有可能被误导的是 import这个关键词。

  • 1.这里利用的是bable来进行转化 安装babel-loader   @babel/core   @babel/preset-env yarn add babel-loader   @babel/core   @babel/preset-env -D 在webpack中配置如下: 在module中的规则rules里面要使用 babel-loader,如下 module:{ rul

  • 把es6代码转化为ES5代码,是为了让我们写的javascript代码程序能在低版本的浏览器正常运行,使用的是babel,使用步骤如下: 1、安装跟balbe相关的三个依赖。安装npm install @babel/core @babel/preset-env babel-loade --save-dev 2、安装完babel相关依赖后,要给babel创建一个配置文件,在根目录底下创建一个.bab

  • 创建vue项目步骤忽略… 引入threejs方式【模块式开发】 import * as THREE from "three"; 其他类库引入方式例如: import { RenderPass } from "three/examples/jsm/postprocessing/RenderPass"; import { UnrealBloomPass} from "three/examples/

 相关资料
  • three.js-es6-webpack-starter Three.js ES6 starter project with a sane webpack configuration. Features ES6 support with babel-loader JS linting + code formatting with eslint and prettier Offscreen canv

  • Phaser + ES6 + Webpack. A bootstrap project to create games with Phaser + ES6 + Webpack. Phaser 3 supported in this branch: https://github.com/lean/phaser-es6-webpack/tree/phaser3 Typescript supported

  • generator-angular-webpack-es6 Yeoman generator for AngularJS + Webpack with ES6 and SASS. Latest Webpack with Tree Shaking feature enabled Babel 6 with ES2017 features included Perfectly compatible wi

  • 本文向大家介绍webpack Webpack,React JSX,Babel,ES6,简单配置,包括了webpack Webpack,React JSX,Babel,ES6,简单配置的使用技巧和注意事项,需要的朋友参考一下 示例 确保您安装了正确的npm依赖项(babel决定将其自身拆分为一堆软件包,与“对等依赖项”有关): npm install webpack webpack-node-ext

  • 问题内容: 我是Webpack的新手。我想我做错了。我想使用babel将ES6函数转换为ES5函数。因此,我做了一些研究,发现了babel- loader。但是,我不确定自己在做什么。 我运行npm install babel-loader –save-dev并将其添加到我的package.json中 // package.json // webpack.config.js // app / in

  • Interactive sketches made with three.js. https://ykob.github.io/sketch-threejs/ This code is released under the MIT license. If you want to use some code, you can use these freely by adding license no