我注意到vue-cli webpack project-name模板加载了这些代码。
main.js
...
new Vue({
el: '#app',
render: h => h(App),
});
Run Code Online (Sandbox Code Playgroud)
index.html
...
<head>
...
</head>
<body>
<div id="app"></div> <!-- if I change app to app1, error message states: "Cannot find element app" -->
<script src="./dist/build.js"></script>
</body>
....
Run Code Online (Sandbox Code Playgroud)
两者链接在一起。但是,它们如何链接?它似乎是build.js的结果,但是我无法理解代码,因为它已被编译,缩小,丑化等等。
我的webpack.config.js设置是默认模板。