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

Not work vue serve when index.html without div#app element exists same directory #2169

Open
tohutohu opened this issue Aug 12, 2018 · 4 comments

Comments

@tohutohu
Copy link

Version

3.0.0-rc.12

Node and OS info

Node 10.4.0 / npm 6.3.0 / macOS10.13.6

Steps to reproduce

  1. make sfc.vue file
<template>
  <div>Hello</div>
</template>
  1. create index.html (empty)
  2. exec vue serve sfc.vue
  3. open browser

What is expected?

display Hello

What is actually happening?

error in console

[Vue warn]: Cannot find element: #app vue.runtime.esm.js?77e5:587 

If the contents of index.html are as follows, it works properly

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
 <div id="app"></div>
</body>
</html>
@LinusBorg
Copy link
Member

As at the end of this section you can provide your own index.html - what's not explicitly documented is that it needs an #app element to mount, yes.

@tohutohu
Copy link
Author

Thanks.
I understood that I can use my index.html. However, in that case I can not read external files. The contents of all files are the same as index.html.

.
├── index.html
├── node_modules
├── other.js
└── sfc.vue

index.html

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <title></title>
  <script src="other.js"></script>
</head>
<body>
 <div id="app"></div>
</body>
</html>

other.js

console.log('other.js loaded')

2018-08-13 8 11 20

2018-08-13 8 11 44

It seems that static files are not properly served.

@LinusBorg
Copy link
Member

Well, they should be in a /public directory, like in a normal project.

@tohutohu
Copy link
Author

I understood. Thank you very much.

Then, the document should be written.
I am not native English, so I can not help writing documents.
Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants