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

[WIP] Convert to vanilla JavaScript modules (ES Modules) #183

Draft
wants to merge 18 commits into
base: mainline2.0
Choose a base branch
from

Conversation

trusktr
Copy link

@trusktr trusktr commented Sep 6, 2023

Note

This is branched off of the branch for

See that PR first. For convenience, here's the diff between the branches, as the Files changed will not be as useful.

Description

Converts examples to JavaScript (ES) modules, and imports all libraries via import syntax (except for AWS which is still a global var from a non-module script).

This is WIP, all examples and integration tests load, but Babylon demos have a break from Babylon 5 (see below). We also need to

  • Ensure unit tests work
  • Delete build tools and associated files like webpack.config.js because we're not building the source anymore (unless we still need them for Karma unit tests)
    • deleted webpack config, it wasn't needed for Karma test runner at all.
  • Update release scripts and package.json fields accordingly
  • Update start-* scripts so they open a particular example's folder (similar to what webpack dev server was doing)
  • Ensure the docs build works
  • Ensure any documentation is updated accordingly
  • Fix breakage from Babylon upgrade. This pull request relies on Babylon 5+ for its publishing of JavaScript modules so that we can import them, but it breaks the character animations, which we will need to fix:

Related Issue #

Reviewer Testing Instructions

Submission Checklist

I confirm that I have...

  • removed hard-coded Cognito IDs
  • manually smoke-tested the BabylonJS integration tests
  • manually smoke-tested the BabylonJS demos (note breaking change in the TODO list above)
  • manually smoke-tested the Three.js integration tests
  • manually smoke-tested the Three.js demo

This contribution is licensed under the original MIT-0 license of the repository. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

* fix-broken-webpack-dependency:
  pin webpack dependency versions so they won't break, and we can update them manually when we need to
…having Webpack provide it, and instead import it as a regular JavaScript module (note that Three.js has deprecated the global and will provide only JavaScript modules at version 0.160)
@theVoiceMouse
Copy link

very interested in this. maybe double check "removed hard-coded Cognito IDs". good work.

…o need for `exports` unless multiple paths need configuring, or CommonJS support is needed, but we're no longer explicitly supporting CommonJS modules, and CommonJS users can use the `import()` function to import the lib, and they can even use the `deasync` package if they really really want the import to be "synchronous", so there's really no need to hold onto the past and we can make moving forward as simple and standards-based as possible)
…st CDN link to aws-sdk and use the local version, and update docs as needed for the new ESM format without a required build
@trusktr
Copy link
Author

trusktr commented Oct 11, 2023

At this point, ESM changes are complete, and this is representative of the new repo format in every way. We just need to apply the fix for Babylon's animation API.

@trusktr
Copy link
Author

trusktr commented Oct 11, 2023

very interested in this. maybe double check "removed hard-coded Cognito IDs". good work.

@theVoiceMouse Thanks! Indeed, I'll squash this, and I'll void that key and make myself a new one. :)

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.

Remove webpack, use vanilla ES Modules to simplify the project.
2 participants