日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > vue >内容正文

vue

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

發(fā)布時(shí)間:2023/12/20 vue 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vue indev.html,webpack - Can't add script tag to Vue component files ( *.vue ) - Stack Overflow 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

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

總結(jié)

以上是生活随笔為你收集整理的vue indev.html,webpack - Can't add script tag to Vue component files ( *.vue ) - Stack Overflow的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。