I'm new to vue.js.

I'm trying to render vue component file but when I add to vue component, for example, app/javascript/packs/components/app.vue file, compiling error happens in babel-loader.

error log

ERROR in ./node_modules/babel-loader/lib??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./app/javascript/packs/app.vue?vue&type=script&lang=js

Module build failed: ReferenceError: [BABEL] /Users/shiho/dev/appname/app/javascript/packs/app.vue: Unknown option: base.omit. Check out http://babeljs.io/docs/usage/options/ for more information about options.

A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

Invalid:

`{ presets: [{option: value}] }`

Valid:

`{ presets: [['presetName', {option: value}]] }`

For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.

at Logger.error (/Users/shiho/dev/appname/node_modules/babel-core/lib/transformation/file/logger.js:41:11)

at OptionManager.mergeOptions (/Users/shiho/dev/appname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:226:20)

at OptionManager.init (/Users/shiho/dev/appname/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)

at File.initOptions (/Users/shiho/dev/appname/node_modules/babel-core/lib/transformation/file/index.js:212:65)

at new File (/Users/shiho/dev/appname/node_modules/babel-core/lib/transformation/file/index.js:135:24)

at Pipeline.transform (/Users/shiho/dev/appname/node_modules/babel-core/lib/transformation/pipeline.js:46:16)

at transpile (/Users/shiho/dev/appname/node_modules/babel-loader/lib/index.js:50:20)

at Object.module.exports (/Users/shiho/dev/appname/node_modules/babel-loader/lib/index.js:173:20)

@ ./app/javascript/packs/app.vue?vue&type=script&lang=js 1:0-178 1:199-374

@ ./app/javascript/packs/app.vue

.babelrc

{

"presets": [

["env", {

"modules": false,

"targets": {

"browsers": "> 1%",

"uglify": true

},

"useBuiltIns": true

}]

],

"plugins": [

"syntax-dynamic-import",

"transform-object-rest-spread",

["transform-class-properties", { "spec": true }]

]

}

loader

% cat config/webpack/loaders/vue.js

const { dev_server: devServer } = require('@rails/webpacker').config

const isProduction = process.env.NODE_ENV === 'production'

const inDevServer = process.argv.find(v => v.includes('webpack-dev-server'))

module.exports = {

test: /\.vue$/,

loader: 'vue-loader',

options: {

loaders: {

js: [

{ loader: 'babel-loader' }

]

}

}

}

confing/webpack/vue.js

const { dev_server: devServer } = require('@rails/webpacker').config

const isProduction = process.env.NODE_ENV === 'production'

const inDevServer = process.argv.find(v => v.includes('webpack-dev-server'))

module.exports = {

test: /\.vue(\.erb)?$/,

use: [{

loader: 'vue-loader'

}]

}

app.vue

export default {

data: function () {

return {

message: "Hello Vue!"

}

}

}

Even when I remove presets from .babelrc, same error occurred.

import Vue from 'vue/dist/vue.esm'

import InfiniteLoading from 'vue-infinite-loading';

import Item from './components/Item.vue'

window.onload = function() {

var highlightViewModel = new Vue({

el: '#home-wrapper',

data: {

show: false,

loading: false,

message: '',

items: [],

message: 'helloooo',

},

beforeMount: function () {

var that = this

var params = {

url: '/items/get_timeline.json',

method: 'GET'

}

$.ajax(params).done(function(data){

console.log(data.items);

that.items = data.items;

Vue.nextTick(function () {

$('.timeago').timeago();

});

});

},

components: {

InfiniteLoading,

Item

},

...

app/javascript/packs/components/Item.vue

aaa

app/view/users/home.html.erb

vue indev.html,webpack - Can't add script tag to Vue component files ( *.vue ) - Stack Overflow相关推荐

  1. vue indev.html,webpack多入口热加载很慢

    项目是多入口(多页面),每次修改代码,热加载都很慢,定格在 94% asset optimization持续5秒左右,页面才更新内容.这个应该是webpack存在的问题. 我发现减少页面数量,热加载会 ...

  2. [Vue warn]: Unknown custom element did you register the component correctly? vue.js:597

    关于Vue插槽使用中遇到 Unknown custom element did you register the component correctly? vue.js:597的解决方案 运行后无显示 ...

  3. Vue+网络协议+Webpack高频面试题

    文章目录 Vue vue的优点是什么? vue生命周期(重要) created和mounted的区别(重点) 什么是 MVVM? 双向数据绑定原理(重点) vue自定义指令 vue自定义组件 Vue组 ...

  4. Vue全家桶 + webpack 构建单页应用初体验

    文章指南 主题   承接这上一篇Vue + Webpack 构建模块化开发框架详解,我们知道了如何使用webpack对vue进行打包,从而开始我们的前端模块化开发之路,这一篇在上一篇的基础上讲解 Vu ...

  5. 从零开始手写vue项目的webpack基础配置

    一.创建目录结构 执行yarn init, 生成package.json文件; 1.写入文件 建立目录结构可参考vue项目目录结构: 首先建立一个src文件夹,其中包含index.html,App.v ...

  6. Did you forget add @script or @script_method annotation? If this is a nn.ModuleList, add it to __con

    参考:https://github.com/pytorch/pytorch/issues/16123 Did you forget add @script or @script_method anno ...

  7. 总结下用Vue.js和webpack遇到的问题

    这段时间用vue.js+webpack做一个单页应用的demo,第一次尝试模块化,技术水平有限,学习不够深入,总是遇到各种问题,所谓前事不忘后事之师,so记录下. 1.ES6匿名函数里面this值 结 ...

  8. html引用单文件组件,webpack入坑之旅(五)加载vue单文件组件_html/css_WEB-ITnose

    需要什么? 在经过前面的四个练习,相信已经对于 webapck有了一定的了解,现在我们就来一个综合案例,进一步甲申年对于 webpack的理解. 首先我们应该思考要解析 .vue类型的文件,需要什么样 ...

  9. Vue.js 与 Webpack externals 的使用

    通过配置 externals 实现打生产包时排除某些依赖,使用 cdn 资源代替.下面代码适用于 vue-cli 3. vue.config.js // 排除 vue, vue-router, vue ...

最新文章

  1. 不断提升自己创造溢价的能力
  2. 【Java】奇葩的猴子排序
  3. soul刷屏编程代码_奔涌吧,编程!少儿编程教育在未来会像语文,数学一样重要!...
  4. 创建ASP.NET Core MVC应用程序(3)-基于Entity Framework Core(Code First)创建MySQL数据库表
  5. php如何判断是否为json数据(格式)
  6. 众多优质资源限时看,24小时删!
  7. 高德地图报Native method not found: com.autonavi.amap.mapcore.MapCore.nativeNewInstance:
  8. IPTV系统搭建网络盒子APK和后台管理软件
  9. 在jsp代码添加背景图片
  10. MTK最新工具(刷机,写号,升级等)合集含工具源码
  11. java学生健康体检档案管理系统ssm313hf
  12. 洛谷 P4654 [CEOI2017] Mousetrap 题解
  13. escharts 柱状图 百分比_Echarts柱状图百分比显示
  14. 解决AssertionError Torch not compiled with CUDA enabled问题
  15. Pymol获得蛋白中二级结构信息
  16. 组装计算机主机算固定资产吗,​购买电脑配件组装电脑属于固定资产吗
  17. 爱奇艺大裁员,互联网的苦日子来了…
  18. [经验分享]长期有效的推广网店的方法
  19. 如何使用ue编辑java,UltraEdit文字编辑器教程:UltraEdit / UEStudio脚本访问剪贴板内容...
  20. python-电脑调用手机摄像头

热门文章

  1. CentOS MySQL 5.7编译安装
  2. JMeter响应断言详解
  3. qunit 前端脚本测试用例
  4. 利用malloc定义数组
  5. 8天玩转并行开发——第五天 同步机制(下)
  6. Ignite中的机器学习介绍
  7. CentOS新增用户并授予sudo权限
  8. Hadoop的学习路线图
  9. CocoaPods pod install/pod update更新慢的问题
  10. 【原】iOS:手把手教你发布代码到CocoaPods(Trunk方式)