vuejs-templates / pwa

PWA template for vue-cli based on the webpack template
MIT License
3.04k stars 507 forks source link

Explore switching to runtime only build #6

Open addyosmani opened 7 years ago

addyosmani commented 7 years ago

From @yyx990803:

FYI if we use the runtime only build we can shave off another ~7kb

From the docs, just switching over to:

module.exports = {
  // ...
  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.esm.js' // 'vue/dist/vue.common.js' for webpack 1
    }
  }
}

with a comment linking up to why we're doing this should do the trick.

We currently already have this kinda setup here https://github.com/vuejs/pwa/blob/prototype/template/build/webpack.base.conf.js#L23 but requires switching to a standalone build. Perhaps we should just nix the standalone check and run it by default.

maxmilton commented 7 years ago

For a pure SPA it totally makes sense to use the runtime only build. This is great when I have full control over a sites design.

However, in the corporate space, I often have to deal with legacy sites where I have to take a MPA approach and can only introduce Vue progressively. In this case having the compiler is super handy since I can turn output from backend systems into a Vue template dynamically. It's much easier for backend devs to get started with Vue basics too without having to poke around with many frontend assets like *.vue files.

I'm in favour of keeping it as an option during the template init so we've got the choice. However, we could change the default option to "runtime only" and/or update the option description.

P.s. @addyosmani loved your Google I/O presentation this year! :heart:

addyosmani commented 7 years ago

Thanks, @MaxMilton! Appreciate the input on this issue as well.

anubhav7495 commented 7 years ago

@addyosmani I believe we should keep the standalone option as a choice for the build but should make the runtime choice as default. Currently standalone gets selected by default.

If this sounds acceptable, I would open a PR for it. Thanks.

ragingwind commented 7 years ago

I bet make runtime into a default option, and how about support guide documents for mifration like recipes