質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Vue.js

Vue.jsは、Webアプリケーションのインターフェースを構築するためのオープンソースJavaScriptフレームワークです。

Q&A

0回答

508閲覧

vue-fullcalendar

syoyu

総合スコア13

Vue.js

Vue.jsは、Webアプリケーションのインターフェースを構築するためのオープンソースJavaScriptフレームワークです。

0グッド

0クリップ

投稿2018/03/12 14:06

編集2018/03/13 16:11

https://github.com/CroudSupport/vue-fullcalendarを実装しようとしています。
ビルドしてみたところ、Uncaught SyntaxError: Unexpected identifierというエラーが出ました。調べてみたのですが理由不明です。エラー箇所はnode_modules/vue-full-calendar/components/FullCalendar.vueというファイルのimport FullCalendar from './components/FullCalendar.vue'という箇所で起きているみたいです。

node_modules/~/FullCalendar.vue

<template> <div ref="calendar" id="calendar"></div> </template> <script> import defaultsDeep from 'lodash.defaultsdeep' import 'fullcalendar' import $ from 'jquery' export default { props: { events: { default() { return [] }, }, eventSources: { default() { return [] }, }, editable: { default() { return true }, }, selectable: { default() { return true }, }, selectHelper: { default() { return true }, }, header: { default() { return { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' } }, }, defaultView: { default() { return 'agendaWeek' }, }, sync: { default() { return false } }, config: { type: Object, default() { return {} }, }, }, computed: { defaultConfig() { const self = this return { header: this.header, defaultView: this.defaultView, editable: this.editable, selectable: this.selectable, selectHelper: this.selectHelper, aspectRatio: 2, timeFormat: 'HH:mm', events: this.events, eventSources: this.eventSources, eventRender(...args) { if (this.sync) { self.events = cal.fullCalendar('clientEvents') } self.$emit('event-render', ...args) }, eventDestroy(event) { if (this.sync) { self.events = cal.fullCalendar('clientEvents') } }, eventClick(...args) { self.$emit('event-selected', ...args) }, eventDrop(...args) { self.$emit('event-drop', ...args) }, eventResize(...args) { self.$emit('event-resize', ...args) }, dayClick(...args){ self.$emit('day-click', ...args) }, select(start, end, jsEvent, view, resource) { self.$emit('event-created', { start, end, allDay: !start.hasTime() && !end.hasTime(), view, resource }) } } }, }, mounted() { const cal = $(this.$el), self = this this.$on('remove-event', (event) => { if(event && event.hasOwnProperty('id')){ $(this.$el).fullCalendar('removeEvents', event.id); }else{ $(this.$el).fullCalendar('removeEvents', event); } }) this.$on('rerender-events', () => { $(this.$el).fullCalendar('rerenderEvents') }) this.$on('refetch-events', () => { $(this.$el).fullCalendar('refetchEvents') }) this.$on('render-event', (event) => { $(this.$el).fullCalendar('renderEvent', event) }) this.$on('reload-events', () => { $(this.$el).fullCalendar('removeEvents') $(this.$el).fullCalendar('addEventSource', this.events) }) this.$on('rebuild-sources', () => { $(this.$el).fullCalendar('removeEventSources') this.eventSources.map(event => { $(this.$el).fullCalendar('addEventSource', event) }) }) cal.fullCalendar(defaultsDeep(this.config, this.defaultConfig)) }, methods: { fireMethod(...options) { return $(this.$el).fullCalendar(...options) }, }, watch: { events: { deep: true, handler(val) { $(this.$el).fullCalendar('removeEvents') $(this.$el).fullCalendar('addEventSource', this.events) }, }, eventSources: { deep: true, handler(val) { this.$emit('rebuild-sources') }, }, }, beforeDestroy() { this.$off('remove-event') this.$off('rerender-events') this.$off('refetch-events') this.$off('render-event') this.$off('reload-events') this.$off('rebuild-sources') }, } </script>

webpack.dev.config.js

js

1try { 2 var path = require('path'); 3 var os = require('os'); 4 var cordovaNodeModules = path.join(os.homedir(), '.cordova', 'node_modules'); 5 6 var webpack = require(path.join(cordovaNodeModules, 'webpack')); 7 var HtmlWebpackPlugin = require(path.join(cordovaNodeModules, 'html-webpack-plugin')); 8 var ExtractTextPlugin = require(path.join(cordovaNodeModules, 'extract-text-webpack-plugin')); 9 var ProgressBarPlugin = require(path.join(cordovaNodeModules, 'progress-bar-webpack-plugin')); 10 11 var cssnext = require(path.join(cordovaNodeModules, 'postcss-cssnext')); 12 var postcssImport = require(path.join(cordovaNodeModules, 'postcss-import')); 13 var postcssUrl = require(path.join(cordovaNodeModules, 'postcss-url')); 14 15} catch (e) { 16 throw new Error('Missing Webpack Build Dependencies.'); 17} 18 19module.exports = { 20 devtool: 'inline-source-map', 21 context: __dirname, 22 debug: true, 23 cache: true, 24 25 entry: [ 26 'webpack/hot/only-dev-server', 27 './src/main' 28 ], 29 30 output: { 31 path: path.join(__dirname, 'www'), 32 filename: 'bundle.js', 33 publicPath:'/' 34 }, 35 36 resolve: { 37 root: [ 38 path.join(__dirname, 'src'), 39 path.join(__dirname, 'node_modules'), 40 path.resolve(cordovaNodeModules) 41 ], 42 43 extensions: ['', '.js', '.vue', '.json', '.css', '.html', '.styl'], 44 45 unsafeCache: true, 46 47 alias: { 48 vue:'vue/dist/vue.common.js' 49 }, 50 51}, 52 53 module: { 54 55 56 loaders: [{ 57 test: /.vue$/, 58 loader: 'vue-loader' 59 }, { 60 test: /.js$/, 61 loader: 'babel', 62 exclude: /node_modules/ 63 }, { 64 test: /.html$/, 65 loader: 'html' 66 }, { 67 test: /.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)(?\S*)?$/, 68 loader: 'file?name=assets/[name].[hash].[ext]' 69 }, { 70 test: /.css$/, 71 include: [ 72 path.join(__dirname, 'node_modules', 'onsenui', 'css-components-src', 'src'), 73 path.join(__dirname, 'src') 74 ], 75 loader: ExtractTextPlugin.extract('style', 'css?importLoaders=1&-raw!postcss-loader') 76 }, { 77 test: /.css$/, 78 exclude: [ 79 path.join(__dirname, 'node_modules', 'onsenui', 'css-components-src', 'src'), 80 path.join(__dirname, 'src') 81 ], 82 loader: ExtractTextPlugin.extract('style', 'css?sourceMap') 83 }, { 84 test: /.json$/, 85 loader: 'json' 86 }] 87 }, 88 89 vue: { 90 loaders: { 91 js: 'babel' 92 } 93 }, 94 95 babel: { 96 presets: [ 97 path.join(cordovaNodeModules, 'babel-preset-es2015') 98 ], 99 }, 100 101 postcss: function() { 102 return [ 103 postcssImport, 104 postcssUrl, 105 cssnext({ 106 browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1'] 107 }) 108 ] 109 }, 110 111 plugins: [ 112 new webpack.HotModuleReplacementPlugin(), 113 new ExtractTextPlugin('[name].css'), 114 new HtmlWebpackPlugin({ 115 template: 'src/public/index.html.ejs', 116 chunksSortMode: 'dependency' 117 }), 118 new ProgressBarPlugin() 119 ], 120 121 resolveLoader: { 122 root: [ 123 path.join(__dirname, 'node_modules'), 124 cordovaNodeModules 125 ] 126 }, 127 128 devServer: { 129 contentBase: './src/public', 130 colors: true, 131 inline: true, 132 historyApiFallback: true, 133 host: '0.0.0.0', 134 stats: 'minimal', 135 hot: true 136 } 137}; 138

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

karamarimo

2018/03/13 02:51

ビルドのコンフィグファイルを載せたほうがいいと思います(webpack なら webapck.config.js みたいな名前のファイル)。
syoyu

2018/03/13 15:57

追記します。ご指摘ありがとうございます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問