LoginSignup
2
2

More than 5 years have passed since last update.

Parcel+VueJS環境づくりまで(多分最終)

Last updated at Posted at 2018-11-17

古い情報の記事にたまに反応が来るので最終版書きました

parcelとは

https://parceljs.org/
コンフィグ無しでウェブアプリケーション作ろうぜ・・・って言う感じのビルドツール

公式サイトでドキュメントあるのでみたらとても簡単になってます

環境構築

npm install --save vue
npm install --save-dev parcel-bundler

index.html
<html>
<body>
  <div id="app"></div>
  <script src="./index.js"></script>
</body>
</html>
src/index.js
import Vue from 'vue/dist/vue.esm.js';
import MyApp from './MyApp.vue';

new Vue({
  el: '#app',
  components: {
    MyApp,
  },
  template: '<my-app></my-app>',
});
MyApp.vue
<template>
  <div>
    {{ title }}
  </div>
</template>

<style>
</style>

<script>
  export default {
    data() {
      return({
        title: 'Hello World!',
      });
    },
  }
</script>
package.json
// parcel起動コマンド登録のため下記start部分を追加
"scripts": {
  "start": "parcel index.html"
}
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2