Try to play a .mov file in Vue, unable to complie - vue.js

A .mov file is necessary to cater Safari users.
However in vue:
<video
id="myvideo"
autoplay
muted
loop
playsinline
>
<source src="#/assets/01/output2.mov" type="video/quicktime" />
</video>
When I trying to compile, "npm run serve" to start the local host:
ERROR Failed to compile with 1 error 5:40:14 pm
error in ./src/assets/01/output2.mov
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
Not sure what to do, i try to instaill a package: File Loader, setup some config in vue.config.js:
module.exports = {
module: {
rules: [
{ test: /\.mov$/, use: 'file-loader' }
],
},
}
However, after i try to run it again, it saids: "Module is not allowed"
My package.json
"dependencies": {
"bootstrap": "^4.5.3",
"bootstrap-vue": "^2.21.2",
"core-js": "^3.6.5",
"file-loader": "^6.2.0",
"gsap": "^3.8.0",
"vue": "^2.6.11",
"vue-cool-lightbox": "^2.7.4",
"vue-i18n": "^8.26.3",
"vue-meta": "^2.4.0",
"vue-router": "^3.2.0",
"vue-slick-carousel": "^1.0.6"
},
"devDependencies": {
"#intlify/vue-i18n-loader": "^1.1.0",
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.2",
"vue-cli-plugin-i18n": "~2.3.1",
"vue-template-compiler": "^2.6.11"
},
Thank you all kindly~!

For me it went through like this
module.exports = {
productionSourceMap: false,
transpileDependencies: [
'vuetify'
],
chainWebpack: config => {
config.module
.rule('mov')
.test(/\.mov$/)
.use('file-loader')
.loader('file-loader')
.end()
}
}
My package.json
"dependencies": {
"#lottiefiles/lottie-interactivity": "^1.2.0",
"#lottiefiles/lottie-player": "^1.4.5",
"core-js": "^3.6.5",
"vue": "^2.6.11",
"vue-axios": "^3.4.0",
"vue-meta": "^2.4.0",
"vue-moment": "^4.1.0",
"vue-router": "^3.2.0",
"vuetify": "^2.4.0",
"vuex": "^3.6.2"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"axios": "^0.18.0",
"babel-eslint": "^10.1.0",
"css-loader": "^6.5.1",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"sass": "~1.32.0",
"sass-loader": "^10.0.0",
"style-loader": "^3.3.1",
"stylus": "^0.55.0",
"stylus-loader": "^6.2.0",
"vue-cli-plugin-axios": "~0.0.4",
"vue-cli-plugin-vuetify": "~2.4.3",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.7.0"
},

Related

bootstrap-vue carousel slides not updating after adding new image

I am trying to use bootstrap-vue b-carousel component adding dynamic images to the carousel does not update the carousel content. Here is my test:
<b-carousel v-model="active" fade :interval="1000" :id="'carousel' + items.length" indicators controls clajss="picture-viewer-carousbel">
<b-carousel-slide v-for="(item,index) in items" :id="'slideId'+index" :key="'slideId'+index" :img-src="item" img-width="100%">
</b-carousel-slide>
</b-carousel>
And here is the code part
export default {
name: 'App',
data: function () {
return {
active: 0,
items: ['https://picsum.photos/1024/480/?image=10']
}
},
mounted () {
this.items.push('https://picsum.photos/1024/480/?image=12')
}
}
I am expecting the carousel to display 2 images but it isn't it only displays one image, even though the reactivity is working correctly because the id of the carousel which takes into account the number of slides is correct (:id="'carousel' + items.length") is 'carousel2'. It would be 'carousel1' if the reactivity would not be working.
Not sure what and if I am doing something wrong but any help is welcome
Thanks
Pat
package.json
{
"name": "bootstrapvue",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.36",
"#fortawesome/free-solid-svg-icons": "^5.15.4",
"#fortawesome/pro-light-svg-icons": "^6.0.0-beta2",
"#fortawesome/pro-regular-svg-icons": "^6.0.0-beta2",
"#fortawesome/pro-solid-svg-icons": "^6.0.0-beta2",
"#fortawesome/vue-fontawesome": "^2.0.2",
"#progress/kendo-data-query": "^1.5.5",
"#progress/kendo-drawing": "^1.14.0",
"#progress/kendo-licensing": "^1.2.0",
"#progress/kendo-theme-bootstrap": "^4.41.2",
"#progress/kendo-vue-animation": "^2.5.0",
"#progress/kendo-vue-data-tools": "^2.5.0",
"#progress/kendo-vue-dateinputs": "^2.5.0",
"#progress/kendo-vue-dropdowns": "^2.5.0",
"#progress/kendo-vue-grid": "^2.5.0",
"#progress/kendo-vue-inputs": "^2.5.0",
"#progress/kendo-vue-intl": "^2.5.0",
"axios": "^0.21.4",
"bootstrap-icons": "^1.5.0",
"core-js": "^3.18.1",
"interactjs": "^1.10.11",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"normalizr": "^3.6.1",
"portal-vue": "^2.1.7",
"sortablejs": "^1.14.0",
"vue": "^2.6.14",
"vue-fontawesome": "0.0.2",
"vue-resizable": "^2.0.5",
"vue-router": "^3.5.2",
"vuedraggable": "^2.24.3",
"vuetify": "^2.5.9",
"vuex": "^3.4.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-plugin-unit-jest": "~4.5.0",
"#vue/cli-plugin-vuex": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/eslint-config-standard": "^5.1.2",
"#vue/test-utils": "^1.2.2",
"babel-eslint": "^10.1.0",
"bootstrap": "4.5.3",
"bootstrap-vue": "2.21.2",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2",
"sass": "^1.42.1",
"sass-loader": "^8.0.0",
"vue-template-compiler": "^2.6.14"
}
}

What could be wrong with the Vue 3 compat build setup?

TLDR: custom events ($listeners) won't be automatically binded in the vue 3 compat build. It is as if all the components would have inheritAttrs: false (although $attrs will be binded and it doesn't include class/style either as the docs say it would)
I followed the official vue 3 migration guide with the compat build, it should've been relatively easy to migrate, however it seems a bit harder as expected. So I added the following code to the vue.config.js:
// Vue 2 => Vue 3 migration config
config.resolve.alias.set('vue', '#vue/compat');
config.module
.rule('vue')
.use('vue-loader')
.tap((options) => ({
...options,
compilerOptions: {
compatConfig: {
MODE: 3,
},
},
}));
Most of the work is already done, however I realised that none of the listeners seems to be working. After some investigation I found out that the $listeners object won't be automatically binded as they should be. They aren't included for some reason in the $attrs object neither will they be inherited (I guess they are related).
I tried INSTANCE_LISTENERS: false, option with both false and true values, unfortunately neither seemed to work. Now the only option I can see right now is adding v-on="$listeners" to all components that may need to bind any events. This is obviously not a good solution, it is hacky and they are also removed in vue 3 completely but I couldn't think of another solution. Did anybody else experience the same and know maybe a better solution for this?
Thanks for your help in advance!
EDIT:
I thought maybe sharing the dependencies could help in detecting the issue so here they are:
"dependencies": {
"#apollo/client": "^3.5.5",
"#datadog/browser-logs": "^2.17.0",
"#datadog/browser-rum": "^2.17.0",
"#popperjs/core": "^2.10.1",
"#rd-internal/rd-vue-gtm": "^1.1.0",
"#vue/apollo-option": "^4.0.0-alpha.15",
"#vue/compat": "^3.2.23",
"#vue/runtime-dom": "^3.2.23",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"apollo-link-schema": "^1.2.5",
"apollo-upload-client": "^14.1.3",
"bootstrap": "^5.1.0",
"bootstrap-vue": "^2.21.2",
"chart.js": "^2.9.4",
"core-js": "^3.17.2",
"dayjs": "^1.10.6",
"graphql": "^15.7.2",
"graphql-tag": "^2.12.6",
"graphql-tools": "^4.0.7",
"intersection-observer": "^0.12.0",
"loader-utils": "^2.0.0",
"lodash.clonedeep": "^4.5.0",
"lodash.debounce": "^4.0.8",
"lodash.get": "^4.4.2",
"lodash.isequal": "^4.5.0",
"lodash.merge": "^4.6.2",
"lodash.set": "^4.3.2",
"lodash.some": "^4.6.0",
"normalize.css": "^8.0.1",
"papaparse": "^5.3.1",
"tinycolor2": "^1.4.2",
"v-tooltip": "^2.1.3",
"vue": "^3.2.23",
"vue-apollo": "^3.0.7",
"vue-chartjs": "^3.5.1",
"vue-ctk-date-time-picker": "^2.5.0",
"vue-i18n": "^9.2.0-beta.22",
"vue-meta": "^2.4.0",
"vue-router": "^4.0.12",
"vuelidate": "^0.7.6",
"vuelidate-error-extractor": "^2.4.1",
"whatwg-fetch": "^3.6.2"
},
"devDependencies": {
"#intlify/eslint-plugin-vue-i18n": "^1.2.0",
"#jagi/jest-transform-graphql": "^1.0.2",
"#testing-library/jest-dom": "^5.14.1",
"#typescript-eslint/eslint-plugin": "^4.30.0",
"#typescript-eslint/parser": "^4.30.0",
"#vue/cli-plugin-babel": "^4.5.15",
"#vue/cli-plugin-eslint": "^4.5.15",
"#vue/cli-plugin-typescript": "^4.5.15",
"#vue/cli-plugin-unit-jest": "^4.5.15",
"#vue/cli-service": "^4.5.15",
"#vue/compiler-sfc": "^3.2.23",
"#vue/eslint-config-airbnb": "^5.3.0",
"#vue/eslint-config-typescript": "^7.0.0",
"#vue/test-utils": "^1.2.2",
"babel-eslint": "^10.1.0",
"babel-jest": "^27.1.0",
"casual-browserify": "^1.5.19-2",
"change-case": "^4.1.2",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-sonarjs": "^0.10.0",
"eslint-plugin-unicorn": "^35.0.0",
"eslint-plugin-vue": "^7.17.0",
"eslint-plugin-vue-scoped-css": "^1.3.0",
"full-icu": "^1.3.4",
"glob": "^7.1.7",
"html-webpack-plugin": "^4.5.1",
"hygen": "^6.1.0",
"inflection": "^1.13.1",
"jest-junit": "^12.2.0",
"lint-staged": "^11.1.2",
"node-sass": "^6.0.1",
"sass-loader": "^10.2.0",
"sockjs-client": "^1.5.2",
"style-resources-loader": "^1.4.1",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0",
"stylelint-declaration-use-variable": "^1.7.3",
"stylelint-no-unsupported-browser-features": "^5.0.1",
"stylelint-order": "^4.1.0",
"stylelint-scss": "^3.20.1",
"ts-jest": "^24.3.0",
"typescript": "^4.4.2",
"vue-cli-plugin-webpack-bundle-analyzer": "~4.0.0",
"vue-composition-test-utils": "^1.0.3"
},

Babel - can not use async/await and regeneratorRuntime error

I am trying to write testing for Vue application by using Vue Test Utils. I have faced the issue "ReferenceError: regeneratorRuntime is not defined" because of compiling async/await in babel.
Searching online, I installed the following dependencies
In my "devDependencies"
"#babel/core": "^7.15.0",
"#babel/plugin-transform-runtime": "^7.15.0",
"#babel/preset-env": "^7.15.0",
"#vue/cli-plugin-babel": "^3.1.1",
"#vue/cli-plugin-eslint": "^3.1.1",
"#vue/cli-plugin-unit-jest": "^4.5.13",
"#vue/cli-service": "^3.1.1",
"#vue/test-utils": "^1.2.2",
"babel-cli": "^6.26.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^27.0.6",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
In my "dependencies"
"babel-polyfill": "^6.26.0",
"core-js": "^3.16.3",
Also, added the plugins in babel.config.js
module.exports = {
presets: ['#vue/app', "#babel/preset-env"],
plugins: ['#babel/plugin-transform-runtime', "transform-regenerator"],
}
But when run a test, it still output the same error about ReferenceError: regeneratorRuntime is not defined. I really like to know what's going on with it...Thanks.

Vue-jest Failed to collect coverage from vue file

Hello I'm new to vue and jest. I added jest to already existing vue project.
And I want get test coverage result from .js and .vue file.
But. It dosen't go well.
When I try run
vue-cli-service test:unit
Return below Error
Failed to collect coverage from D:\work\project\src\components\service\sidebar\partials\menu.vue
ERROR: Falsy value found in plugins
Here is my config files
.babelrc
{
"presets": [
["env"], "stage-2"
],
"plugins": ["dynamic-import-node"],
"comments": true
}
jset.config.js
module.exports = {
preset: '#vue/cli-plugin-unit-jest/presets/no-babel',
moduleNameMapper: {
'^#/(.*)$': '<rootDir>/src/$1'
},
collectCoverage :true,
moduleFileExtensions: [
'js',
'json',
'vue'
],
transform: {
// process `*.vue` files with `vue-jest`
".*\\.(vue)$": "vue-jest",
// process js with `babel-jest`
"^.+\\.js$": "<rootDir>/node_modules/babel-jest"
},
collectCoverageFrom: [
'**/*.{js,vue}',
'!**/plugins/**',
'!src/main.js',
'!src/router/index.js',
'!**/node_modules/**'
]
}
package.json
{
"name": "web-application",
"version": "1.0.0",
"private": true,
"description": "web-application",
"author": "John",
"scripts": {
...
"test:unit": "vue-cli-service test:unit",
},
"dependencies": {
...
"copy-webpack-plugin": "^4.6.0",
"dotenv": "^8.1.0",
"element-ui": "^2.10.0",
"eslint-plugin-vue": "^5.2.3",
"fs": "0.0.1-security",
"log4js": "^5.0.0",
"lottie-web": "^5.5.5",
"pm2": "^3.5.1",
"recordrtc": "^5.5.8",
"request": "^2.88.0",
"sweetalert2": "^8.13.0",
"vue": "^2.6.10",
"vue-croppie": "^1.3.13",
"vue-drag-select": "^0.1.5",
"vue-izitoast": "^1.2.1",
"vue-moment": "^4.0.0",
"vue-raven": "^1.0.3",
"vue-router": "^3.1.3",
"vue-tilt.js": "^1.0.2",
"vue-toasted": "^1.1.27",
"vue2-scrollbar": "0.0.3",
"vuex": "^3.1.1"
},
"devDependencies": {
"#babel/preset-env": "^7.4.5",
"#vue/cli-plugin-unit-jest": "^4.2.3",
"#vue/cli-service": "^4.2.3",
"#vue/test-utils": "^1.0.0-beta.31",
"babel-core": "^6.25.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^25.2.3",
"babel-loader": "^7.1.1",
"babel-plugin-dynamic-import-node": "^2.3.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-2": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"crypto-js": "^3.1.9-1",
"css-hot-loader": "^1.4.4",
"css-loader": "^1.0.1",
"es6-promise": "^4.2.8",
"eslint": "^4.19.1",
"eslint-config-prettier": "^6.5.0",
"eslint-config-vue": "^2.0.2",
"eslint-plugin-html": "^4.0.6",
"eslint-plugin-prettier": "^3.1.1",
"file-loader": "^1.1.11",
"file-saver": "^1.3.8",
"glob": "^7.1.4",
"html-loader": "^0.5.0",
"html-webpack-plugin": "^3.2.0",
"jest": "^24.9.0",
"node-sass": "^4.12.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"pkg": "^4.4.0",
"postcss-loader": "^2.0.6",
"sass-loader": "^7.1.0",
"secure-web-storage": "^1.0.2",
"style-loader": "^0.18.2",
"url-loader": "^1.1.2",
"vue-awesome-swiper": "^3.1.3",
"vue-axios": "^2.1.4",
"vue-i18n": "^8.11.2",
"vue-jest": "^3.0.5",
"vue-loader": "^14.2.2",
"webpack": "^4.39.3",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-cli": "^3.3.5",
"webpack-dev-server": "^3.7.2",
"webpack-merge": "^4.2.1"
},
"bin": {
"app": "./server.js"
},
"lint": "eslint --ext .js,.vue src",
"pkg": {
"assets": [
"dist/**/*"
]
}
}
Please tell me if you need more information. I'll add it.
Thank you for read this question.
This is self answer. Well it was silly problem.
There are three problem
preset: '#vue/cli-plugin-unit-jest/presets/no-babel' in jest.config.js make transform option useless
removed
Jest 24 dosen't support babel 6.
it should be
babel-jest": "^23.6.0"
transform's location was wrong
it should be like
transform: {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
}
Now i fixed three problem. and working good.
I leave this answer because I want my shameful behavior to help others.

VueJS and Jest : Cannot find module 'babel-core'

I'm trying to use Jest with VueJS, however I'm getting Cannot find module 'babel-core' at Object.<anonymous> (node_modules/vue-jest/lib/compilers/babel-compiler.js:1:15).
The only way I could fix this was adding
"#babel/core": "^7.7.5",
"babel-core": "^7.0.0-beta.47",
Then test pass, but I do not want to keep the 'beta' version in my package.json, and it is weird to have #babel/core and babel-core together, knowing they are the same package in different versions.
I see the error seems to be in Vue-Jest, but it is already in last version.
Below is my current package.json that breaks (without "babel-core": "^7.0.0-beta.47")
"dependencies": {
"#vue/babel-preset-app": "^3.12.1",
"axios": "^0.19.0",
"chai": "^4.2.0",
"date-fns": "^1.30.1",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"register-service-worker": "^1.5.2",
"v-click-outside": "^2.1.5",
"vue": "^2.6.10",
"vue-alertify": "^1.1.0",
"vue-body-class": "^2.0.0-beta.2",
"vue-clipboard2": "^0.3.1",
"vue-mq": "^0.1.3",
"vue-multiselect": "^2.1.6",
"vue-recaptcha-v3": "^1.8.0",
"vue-router": "^3.1.3",
"vue-the-mask": "^0.11.1",
"vuelidate": "^0.7.4",
"vuex": "^3.1.2",
"vuex-persist": "^2.2.0"
},
"devDependencies": {
"#babel/core": "^7.7.5",
"#babel/plugin-transform-modules-commonjs": "^7.7.5",
"#babel/polyfill": "^7.7.0",
"#babel/preset-env": "^7.7.5",
"#vue/cli-plugin-babel": "^3.12.1",
"#vue/cli-plugin-eslint": "^3.12.1",
"#vue/cli-plugin-pwa": "^3.12.1",
"#vue/cli-service": "^3.12.1",
"#vue/eslint-config-standard": "^4.0.0",
"#vue/test-utils": "^1.0.0-beta.30",
"babel-eslint": "^10.0.3",
"copy-webpack-plugin": "^5.0.5",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.2.3",
"eslint-plugin-vue-libs": "^3.0.2",
"jest": "^24.9.0",
"vue-jest": "^3.0.5",
"vue-svg-loader": "^0.12.0",
"vue-template-compiler": "^2.6.10"
}
Any help would be appreciated.
just use babel-bridge . from github issue
npm install babel-core#^7.0.0-bridge.0 --save-dev