Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted to ES6 modules #72

Merged
merged 1 commit into from
Oct 29, 2016
Merged

Converted to ES6 modules #72

merged 1 commit into from
Oct 29, 2016

Conversation

terkelg
Copy link
Contributor

@terkelg terkelg commented Sep 24, 2016

Converted to ES6 modules and Rollup, in a way very similar to the latest ThreeJS changes (#9310).
I also updated the closure compiler and added a few NPM scripts.

@terkelg terkelg changed the title Converted to module Converted to ES6 modules Sep 24, 2016
@mrdoob mrdoob merged commit e7230a5 into mrdoob:master Oct 29, 2016
@mrdoob
Copy link
Owner

mrdoob commented Oct 29, 2016

Thanks!

@terkelg
Copy link
Contributor Author

terkelg commented Oct 30, 2016

I'm the one thanking. I admire and appreciate all the amazing and hard work you've done for the open source community.

@cfresh
Copy link
Contributor

cfresh commented Nov 2, 2016

FYI This PR breaks stats.js when retreived over bower. Bower recommends you use the un-minified version as your main (which stats.js does), and the export at the bottom throws a syntax error in the browser.

@terkelg
Copy link
Contributor Author

terkelg commented Nov 2, 2016

Thanks for reporting this! I haven't used it with bower before – I'll look at it

@terkelg
Copy link
Contributor Author

terkelg commented Nov 3, 2016

I just tested this myself with bower, npm and normal script tag in the latest Chrome and didn't get any issues or syntax errors. screenshot

Can you post the error you got, and information about browser?

@Disorrder
Copy link

Disorrder commented Nov 3, 2016

Yes, export Stats as default is good only for using with Webpack or smth like that, but with bower I want only concat all my libs into one file like vendor.js. That's why I have to override "main" to build/stats.min.js
If you use main-bower-files, the temporary solution is override dependency in your bower.json:

  "overrides": {
    "stats.js": {
      "main": "build/stats.min.js"
    }
  }

@cfresh
Copy link
Contributor

cfresh commented Nov 3, 2016

If you aren't seeing an error, then I am assuming you are using build/stats.min.js. If you use src/Stats.js directly in the browser you will see Uncaught SyntaxError: Unexpected token export on line 171. Like @Disorrder said, I am pulling down with bower and concatenating all libs into a single bundle for minification. The gulp package that takes care of bundling uses the file specified as main in bower.json, which happens to be src/Stats.js.

@cfresh
Copy link
Contributor

cfresh commented Nov 3, 2016

Also, in case I am making it sound like the solution is to change "main" to build/stats.min.js, there was already a PR to switch it away from that (#61). The reasons why you don't want to do that are listed in the PR.

@terkelg
Copy link
Contributor Author

terkelg commented Nov 3, 2016

So what we need is to also provide a none-minified ES5 version?

@Disorrder
Copy link

@terkelg make build/stats.js without minify and change "main": "build/stats.js" into bower.json

@terkelg
Copy link
Contributor Author

terkelg commented Nov 4, 2016

@Disorrder and @cfresh thank you so much for the feedback, I really appricate that. Can you guys test this build: https://github.com/terkelg/stats.js - If it works, I'll make a pull request

@cfresh
Copy link
Contributor

cfresh commented Nov 4, 2016

The build on your fork works in my setup, thanks!

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.

4 participants