Vue.config.js could not recognize require('webpack') - vue.js

I create a vue3.0 + ts project by CLI, when I add vue.config.js, it always have error on require
const webpack = require('webpack');
const path = require('path');
The errors are
module "d:/learning/vue-3-ts-demo/node_modules/webpack/types"
Require statement not part of import statement`.
I have install webpack 5.65.0
My packages.json:
{
"name": "vue-3-ts-demo",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0",
"vuex": "^4.0.0-0"
},
"devDependencies": {
"#typescript-eslint/eslint-plugin": "^4.18.0",
"#typescript-eslint/parser": "^4.18.0",
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-plugin-typescript": "~4.5.0",
"#vue/cli-plugin-vuex": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"#vue/eslint-config-typescript": "^7.0.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"typescript": "~4.1.5",
"webpack": "^5.65.0"
}
}
It is a new vue project and what is the problem?

The errors are
module "d:/learning/vue-3-ts-demo/node_modules/webpack/types"
Require statement not part of import statement`.
For this error, I delt with it by adding '#typescript-eslint/no-var-requires': 0 in.eslintrc.js
rules: {
'#typescript-eslint/no-var-requires': 0
}
I have install webpack 5.65.0
Since my vue CLI is 4.5.14, I reinstall webpack version as 4.x too, and it works finally.

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"
}
}

How can I resolve compilation errors in vue using tailwind

{
"name": "active-tracker",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#supabase/supabase-js": "^1.24.0",
"#tailwindcss/postcss7-compat": "^2.0.2",
"core-js": "^3.6.5",
"uid": "^2.0.0",
"vue": "^3.2.33",
"vue-router": "^4.0.0-0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "^5.0.4",
"#vue/cli-plugin-eslint": "^5.0.4",
"#vue/cli-plugin-router": "^5.0.4",
"#vue/cli-service": "^5.0.4",
"#vue/compiler-sfc": "^3.0.0",
"autoprefixer": "^10.4.7",
"babel-core": "^6.26.3",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.5",
"babel-preset-vue": "^2.0.2",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^7.0.0",
"postcss": "^8.4.13",
"sass": "^1.51.0",
"sass-loader": "^8.0.2",
"tailwindcss": "^3.0.24",
"vue-cli-plugin-tailwind": "~2.0.6",
"webpack": "^5.72.0"
}
}

TextGeometry.js and FontLoader.js dependencies were not found

I use Trois.js to create Vue.js+Three.js app. I installed Trois.js library:
npm install three#0.127 troisjs
I imported some basic elements to my Vue module, just like Renderer, Scene etc.
import {Renderer, Scene, Camera, Sphere} from 'troisjs'
When I run npm run serve then the error comes up:
These dependencies were not found:
three/examples/jsm/geometries/TextGeometry.js in ./node_modules/troisjs/build/trois.module.js
three/examples/jsm/loaders/FontLoader.js in ./node_modules/troisjs/build/trois.module.js
What's interesting, TextGeometry and FontLoader exist in node_modules under abovementioned directory:
..build/trois.module.js
import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry.js';
import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js';
...
I don't know why this error comes up, I reinstalled trois.js package but in vain. Still doesn't work. This is my package.json file:
{
"name": "troisapp",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"three": "^0.127.0",
"troisjs": "^0.3.3",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0",
"vuex": "^4.0.0-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-vuex": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"#vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.0.0",
"prettier": "^2.2.1"
},
"description": "## Project setup ``` npm install ```",
"main": ".eslintrc.js",
"keywords": [],
"author": "",
"license": "ISC"
}
TextGeometry and FontLoader were moved to the examples with r133. Meaning trois.js expects that you work with a more recent three.js version and not with r127.

Vue 3 Storybook

I have successfully installed Storybook for Vue, but it doesn't seem to handle Vue 3 components very well.
I believe this is because the Vue version is #vue/cli 4.5.11 when I run "vue -V" & the Storybook is 6.1.17 when I run "start-storybook -V"
I don't get how this works. Am I on Vue 3? How do I get Storybook to understand my Vue 3 components?
Here is my package.json file:
{
"name": "component-library",
"version": "0.1.0",
"private": true,
"description": "Component Library",
"repository": {
"type": "git",
"url": ""
},
"license": "MIT",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -s public"
},
"dependencies": {
"#storybook/theming": "^6.1.18",
"#vue/composition-api": "^1.0.0-rc.2",
"core-js": "^3.6.5",
"vue": "^2.6.11"
},
"devDependencies": {
"#babel/core": "^7.12.10",
"#storybook/addon-actions": "^6.1.11",
"#storybook/addon-essentials": "^6.1.11",
"#storybook/addon-links": "^6.1.11",
"#storybook/addons": "^6.1.18",
"#storybook/vue": "^6.1.11",
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-unit-jest": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/eslint-config-prettier": "^6.0.0",
"#vue/test-utils": "^1.0.3",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^6.2.2",
"prettier": "^1.19.1",
"vue-template-compiler": "^2.6.11"
}
}
Right now, you are on Vue version 2.6.11, which isn't Vue 3.
You can easily upgrade your project with the Vue CLI command:
vue add vue-next
After that make sure to upgrade Storybook:
npx sb#next init
You can checkout the blog post by Storybook about the Vue 3 integration.

missing sass-loader, css-loader dependecies quasar/vue

I recently begun to work on a ongoing project. I cloned the repo, runned "npm install", everything worked fine, but when I tried to run the server I got this:
missing dependecies
trying to run the sugested code didn't work. I also tried installing and reinstalling: css-loader, vue-loader, sass, node-sass and sass-loader.
The error text:
98% after emitting SizeLimitsPlugin
ERROR Failed to compile with 2 errors 10:31:48
These dependencies were not found:
* -!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../styles/sass-framework/colors.scss in ./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/vue-cli-plugin-quasar/lib/loader.auto-import.js?kebab!./node_modules/cache-loader/dist/cjs.js??ref--0-1!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Login.vue?vue&type=style&index=0&id=26084dc2&lang=scss&scoped=true&
* -!../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!./styles/sass-framework/colors.scss in ./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/vue-cli-plugin-quasar/lib/loader.auto-import.js?kebab!./node_modules/cache-loader/dist/cjs.js??ref--0-1!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=scss&
To install them, you can run: npm install --save -!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../styles/sass-framework/colors.scss -!../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!./styles/sass-framework/colors.scss
my package.json:
{
"name": "scale-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#babel/traverse": "^7.10.1",
"#babel/types": "^7.10.2",
"#quasar/extras": "^1.0.0",
"axios": "^0.19.2",
"core-js": "^3.6.4",
"quasar": "^1.0.0",
"vue": "^2.6.11",
"vue-router": "^3.1.6",
"vuex": "^3.1.3"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.3.0",
"#vue/cli-plugin-eslint": "~4.3.0",
"#vue/cli-plugin-router": "~4.3.0",
"#vue/cli-plugin-vuex": "~4.3.0",
"#vue/cli-service": "~4.3.0",
"#vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0",
"babel-plugin-transform-imports": "1.5.0",
"css-loader": "^3.6.0",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.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",
"node-sass": "^4.13.0",
"postcss-loader": "^3.0.0",
"sass-loader": "^8.0.2",
"vue-cli-plugin-quasar": "~2.0.2",
"vue-loader": "^15.9.3",
"vue-svg-loader": "^0.16.0",
"vue-template-compiler": "^2.6.11"
}
}
Any ideas? Thanks in advance.
It was actually a custom dependency that was missing:
./styles/sass-framework/colors.scss
sass-framework is a repo itself and had to be added manually inside the project.