Giter Club home page Giter Club logo

Comments (3)

yyx990803 avatar yyx990803 commented on May 5, 2024 2

I was thinking about dropping the runtime vs. full build dimension and distributing the compiler in a separate package altogether. So the vue package would be only the runtime. This allows us to drop a dimension but you'd have to do something like this to get on-the-fly compilation:

<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/vue-template-compiler"></script>

This allows us to get down to 7 builds in the vue package itself (cjs.js is just a dynamic entry file):

Runtime

  • vue.esm-bundler.js
  • vue.cjs.dev.js
  • vue.cjs.prod.js
  • vue.esm-browser.dev.js
  • vue.esm-browser.prod.js
  • vue.global.dev.js
  • vue.global.prod.js

Compilers

  • compiler.global.dev.js
  • compiler.global.prod.js
  • compiler.esm-browser.dev.js
  • compiler.esm-browser.prod.js

Usage

  • For bundlers, module field defaults to the esm-bundler build.
  • For in browser usage via CDN, unpkg and jsdelivr defaults to the global build. (Users now need to include the compiler separately on page)
  • For Node SSR usage, index field in package.json defaults to the cjs build.
  • The user only needs to specify file path when using ESM directly in browser.

Now assuming we will have an extra dimension for API compat. That leaves us at 7 * 2 = 14 builds for the runtime (runtime API compat doesn't affect the compiler). Which is still kinda ok.

Maybe we can make the 2.x compat code a plugin - which would reduce yet another dimension, but I'm not 100% sure if it can be cleanly done. I'll have to experiment to see if that's possible.

Finally for IE compat - we should probably distribute it in a separate package (like vue-ie11) with the same dist folder layout. So for users that need IE11 support would simply switch the package resolution.

from core.

LinusBorg avatar LinusBorg commented on May 5, 2024

Thanks , that makes sense.

how would the compiler be included in bundler projects?

from core.

yyx990803 avatar yyx990803 commented on May 5, 2024

Well, now that we are (for now) no longer doing the lean build, I think we can close this 😅

The lean build can probably be a compile-time flag (e.g. process.env.LEAN_MODE) preserved in the esm-bundler build.

from core.

Related Issues (20)

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.