Skip to content

Conversation

@HypnosNova
Copy link
Contributor

I add some more rollup plugins and update some configs.

  1. Babel plugins: From now on, Three.js could be written in ES6 gramma and babel plugins can compile code into ES5 code. And code in ES6 would be much easier to write and read.
  2. ESLint plugins: I put eslint loader so when developers build Three.js, it can check the code style without using "npm run lint". In that way, developers must follow the code style rules, otherwise there would be many eslint errors when build Three.js
  3. I remove the glsl loader function from config.js and publish the loader on npm: https://www.npmjs.com/package/rollup-plugin-three-glsl
  4. Minify the code, I create the rollup.uglify.config.js, that would be much easier to use.

@mrdoob mrdoob added this to the r97 milestone Sep 14, 2018
@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 15, 2018

Three.js could be written in ES6 gramma and babel plugins can compile code into ES5 code. And code in ES6 would be much easier to write and read.

I think PRs like #14654 and #14695 should be merged first before changing the build configuration.

@HypnosNova
Copy link
Contributor Author

Looks like closure builder is a better choice, I remove uglify.

@mrdoob mrdoob modified the milestones: r97, r98 Sep 26, 2018
@mrdoob mrdoob modified the milestones: r98, r99 Oct 31, 2018
@mrdoob mrdoob modified the milestones: r99, r100 Nov 30, 2018
@HypnosNova
Copy link
Contributor Author

I update the rollup config recently.
Form now on, we could write code like this:
`class Geometry{
// some code
}

class BoxGeometry extends Geometry{
// some code
}`
without using "function" to create a class and using "xxx.call()" or "xxx.prototype = Object.create(...)" to extends super class.

The code would be more readable and more friendly for module developing.

Another thing is I also add some babel's plugin-proposal. For example we can use these codes like:
`
// in Geometry.js file
export default class Geometry{
// some code
}

// Then in Three.js file
export Geometry from "path/Geometry";
`
We don't need to use {} anymore and babel will translate it into ES5 code. The codes will be much simpler and more clearly.

Other proposal gramma features like class-properties, decorators, object-rest-spread, optional-chaining which are very common used in project developing has already been config.

@mrdoob mrdoob modified the milestones: r100, r101 Dec 31, 2018
@arodic
Copy link
Contributor

arodic commented Jan 2, 2019

I would love to see ES6 widely adopted in threejs. I know there has been a lot of discussion about performance and reverse compatibility issues in #11552 and #14654 (and few other issues I cant find right now).

babel plugins can compile code into ES5 code

If this works and performs more or less same as current code, that would be a very encouraging!

Also, it might be a god idea to squash those 15 commits considering this is a very small PR.

@mrdoob mrdoob modified the milestones: r101, r102 Jan 31, 2019
@mrdoob mrdoob modified the milestones: r102, r103 Feb 28, 2019
@mrdoob mrdoob modified the milestones: r103, r104 Mar 27, 2019
@mrdoob mrdoob modified the milestones: r104, r105 Apr 24, 2019
@mrdoob mrdoob modified the milestones: r105, r106 May 30, 2019
@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 19, 2019

Closing, see #14912 (comment)

@Mugen87 Mugen87 closed this Jun 19, 2019
@Mugen87 Mugen87 removed this from the r106 milestone Jun 19, 2019
@HypnosNova HypnosNova deleted the updateRollup branch March 24, 2020 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants