Giter VIP home page Giter VIP logo

Comments (2)

susnux avatar susnux commented on June 12, 2024 1

Thoughts

From my point of view libraries should not be transpiled, only if written in Typescript (then transpiled to ES version supported by our Node version (currently ES2022)), as I would always recommend transpiling all dependencies to make sure there is no compatibility issue.

This way we could provide smaller bundles as we only need to include polyfills once in the apps and do not have them duplicated within all dependencies / libraries.
Moreover I would recommend simply using ESBuildMinifyPlugin on Apps, which is a lot faster then running babel-loader on every dependency, of cause one would need to include polyfills as well, but this can be handled by webpack-plugin-corejs.
See build time and size comparison data below.

But on a long term I would love to see nextcloud support ES6 modules as scripts, all of out target browser support ES6 natively, the only problem is nextcloud-server which does not support adding ES6 scripts (missing type="module" on script tag).
See also comparison data below why this would yield much better performance.

Build time and size comparison

(based on the `forms` app as this is a mid-size nextcloud application)
Tools Build time Output filesize (sum)
current
webpack + babel (only own source) + terser
21065 ms 26580 KiB
webpack + babel (everything) + terser 25375 ms 22356 KiB
webpack + esbuild + terser 20581 ms 26688 KiB
webpack + esbuild 12811 ms 28260 KiB
webpack + swc 13753 ms 27500 KiB
vite (ES6) 7564 ms 11476 KiB

from standards.

skjnldsv avatar skjnldsv commented on June 12, 2024

From my point of view libraries should not be transpiled, only if written in Typescript (then transpiled to ES version supported by our Node version (currently ES2022)), as I would always recommend transpiling all dependencies to make sure there is no compatibility issue.

I second that.
It will also cleanup our code and libraries boilerplate

But on a long term I would love to see nextcloud support ES6 modules as scripts, all of out target browser support ES6 natively, the only problem is nextcloud-server which does not support adding ES6 scripts (missing type="module" on script tag).

A different discussion, but seeing the table you posted, oh man, sign me up for webpack+swc already! 😱
The difference with what we do is really manageable I'd say

from standards.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.