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

update docs for standalone #3011

Closed
yurii-github opened this issue Oct 28, 2019 · 1 comment
Closed

update docs for standalone #3011

yurii-github opened this issue Oct 28, 2019 · 1 comment

Comments

@yurii-github
Copy link

yurii-github commented Oct 28, 2019

Version

3.1.3

Reproduction link

https://router.vuejs.org/guide/#javascript

Steps to reproduce

  1. read docs https://router.vuejs.org/guide/#javascript
  2. try with vue-loader with single-file component approach (by moving each page component to its file)
  3. see error "Failed to mount component: template or render function not defined."
  4. make ES6 fixes by adding ".default"
    profit
## index.js

import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {path: '/', component: require('./pages/Index.vue').default},
    {path: '/about', component: require('./pages/About.vue').default}
  ]
})

window.app =  new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

What is expected?

docs must have solution for standalone approach when vue compiler IS NOT bundled to webbrowser

What is actually happening?

you don't have such docs, instead you have ton of closed unresolved issues from clients, example:

#824

vuejs/vue-cli#1875

#794

#713

and so on. internet is flooded with this stuff

@posva posva added docs and removed docs labels Feb 6, 2020
@posva
Copy link
Member

posva commented Feb 6, 2020

Impactful contributions to docs are welcomed. In this case though, having to use .default is unrelated to vue, vue-router, or vue's compiler, it's part of the bundler being used and the way the component is exported (module.exports vs export default)

@posva posva closed this as completed Feb 6, 2020
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

2 participants