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

Change to ESM and replace RequireJS with a different bundler #34

Open
pavelhoral opened this issue Feb 16, 2024 · 0 comments
Open

Change to ESM and replace RequireJS with a different bundler #34

pavelhoral opened this issue Feb 16, 2024 · 0 comments

Comments

@pavelhoral
Copy link
Member

I am creating this issue to write down some thoughts about future (hopefully near future) direction
for the wrensec-ui project.

Current state of things

We have recently migrated from Grunt to Gulp. This was intended as an intermediate step which served its
purpose - getting rid of legacy dependencies without requiring a major rewrite. The real target is now to
migrace source code from AMD to ESM and switch to a modern bundler (Webpack/Vite/Rollup).

AMD had its place in the past, but all modern tools and libraries are ESM based. We can not use better tools
than RequireJS if our source code is AMD and we can not simply switch to ESM when our bundler is RequireJS.
ESM will allow us to use modern tools and libraries, use modern ECMA Script syntax and produce better optimized
bundles.

What needs to be done

We need to define migration steps for Wren Security projects based on wrensec-ui. These steps should cover
how to migrate AMD to ESM, determine what tool to use for bundling and how the configuration should look like.

We can define the following goals for the ESM migration:

What is the final target

The final target for the migration is as follows:

  • Have all JavaScript source files in ESM format (either with .jsm or .js extension).
  • Fully getting rid of AMD and RequireJS.
  • Introducing new build system and bundler (Vite, Webpack or vanilla Rollup).
  • Preparing opinionated configuration for the new build system that will be shared with downstream projects.
  • Preparing opinionated development configuration (how to setup dev server with proxy config).

What I want to avoid during the migration:

These are non-goals for the migration:

  • Introducing code splitting or any other advanced bundling techniques (although we might want to introduce this later).
  • Getting rid of dependencies other than RequireJS (BackboneJS stays for now).

Potential risks and challenges

  • Getting BackboneJS to "play nice" with ESM ecosystem can be tricky.
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

No branches or pull requests

1 participant