相關鏈接(網(wǎng)友提供):
默認情況下 Parcel 是支持 React 和 Preact,可以通過查看下面這個頁面得知。
https://parceljs.org/recipes.html
要讓 Parcel 支持 vue,需要簡單處理一下。(下面的方法是我嘗試的,如果有更好的,歡迎評論留言)
首先初始化一個項目。
$ mkdir parcel-vue
$ cd parcel-vue
$ npm init -y
接著安裝 vue。
$ npm install vue
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Parcel Vue</title>
</head>
<body>
<div id="app">
<h1>Hello Parcel</h1>
</div>
<script src="app.js"></script>
</body>
</html>
然后寫一些 vue 的代碼。
app.js
import Vue from 'vue/dist/vue.js';
const app = new Vue({
el: '#app',
template: `<h1>{{ name }}</h1>`,
data() {
return {
name: '謝海濤'
}
}
})
最后,運行 parcel index.html,結果如下:

image.png