天道酬勤,学无止境

vue-cli-3

Vue-cli run build TypeError 'name' Undefined

I just started to use vue-cli and I got stock with a problem. Following the Docs instructions: I installed vue/cli npm install -g @vue/cli (version 3.11.0). I created a project vue create test (default config) and cd into the folder. But when I tried to build the project npm run build, I got this error. TypeError: Cannot read property 'name' of undefined at entrypoint.getFiles.reduce (C:\Users\MyUser\test\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:43:25) at Array.reduce (<anonymous>) at getEntrypointSize (C:\Users\MyUser\test\node_modules\webpack\lib\performance\SizeLimitsPlugin

2021-06-15 03:31:14    分类:问答    vue-cli   vue-cli-3

Vue index.html favicon issue

I am using Vue 2.0 and Vue CLI 3.0. I am trying to get the favicon.ico/png file work properly and am having no luck at all. I have narrowed the issue to the following. The index.html file generated by yarn build converts this line of html code: <link rel="icon" href="favicon.png" > to... <!--[if IE]><link rel="icon" href="favicon.png"><![endif]--> If I go into Chrome developer tools and change the line back to the way I had it originally, the ico/png file renders as expected. My question is: how do I fix this so that yarn build stops messing up my html code.

2021-06-14 11:02:58    分类:问答    vue.js   vuejs2   vue-cli-3

Vue devServer proxy is not helping, I still get CORS error

I'm using @vue/cli 3.x and in my vue.config.js I have this: devServer: { proxy: { "/api": { ws: true, changeOrigin: true, target: "http://localhost:8080" } } } But I keep getting CORS error: Access to XMLHttpRequest at 'http://localhost:8080/api' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Any idea?

2021-06-13 19:18:59    分类:问答    vue.js   webpack   webpack-dev-server   vue-cli-3

Why is there a node_modules folder under my home folder?

I already have a global node_modules folder in /usr/local/lib/node_modules, but I just found there is also a ~/node_modules folder under my home folder. Can I delete this one? I execute node -e "console.log(global.module.paths)" and I get: [ '/Users/Username/node_modules', '/Users/node_modules', '/node_modules' ] And if I delete the node_modules folder, which is under the home directory, then I execute npm list @vue/cli-ui. It would should this error: /Users/Username └── UNMET DEPENDENCY @vue/cli-ui@3.0.1 npm ERR! missing: @vue/cli-ui@3.0.1, required by Username So, can I delete the node

2021-06-11 21:24:53    分类:问答    node.js   npm   vue-cli-3

How to setup a vue-cli with vuetify project to run with IE 11?

I spend a few days to setup a vue.js + vue-cli + typescript + vuetify project to run with IE 11 without success? I found many posts on the net that explain how it should be done but without success. I tried to combine in almost all the ways possible the setup explained below without success, endind with many different errors up to a blank page The application runs fine wit Chrome or FF If someone has such an application running in IE 11 it would be greatly appreciated Context (all the latest versions): vue-cli typescript vue.js + vue-router + vuex + vuex-persistedstate vuetify + vue-i18n +

2021-05-25 04:02:49    分类:问答    vue.js   internet-explorer-11   vuetify.js   vue-cli-3

Vue-cli 3 Environment Variables all undefined

I've tried all of the solutions out there but none seem to work for me. I just want to store some values in a .env file within my Vue app but simply trying to log process.env returns an empty object from within the component. My .env file VUE_APP_URL={api url} VUE_APP_TOKEN={token} My plan was to set these environment variables to data properties but it always returns undefined. If I do console.log(process.env.NODE_ENV) from webpack.config.js it will show that I'm in development but if I tried doing the same from within the component like mounted() { this.$nextTick(() => { console.log(process

2021-05-18 06:36:37    分类:问答    vue.js   vuejs2   environment-variables   vue-cli   vue-cli-3

How do you eventBus a bus to communicate updates to a view in a Vue component?

Listen for custom events for the bus in component b. However, after dispatching events in component a, it accesses component b. the listening function of component b is executed, but msg of data function is not updated Please don't say Vuex. The relevant code is based on Vue CLi3 Here code: Component A: <template> <div> Component A <button @click="sendMsg">pushB</button> </div> </template> <script> import bus from './bus' export default { methods: { sendMsg() { bus.$emit('send', 'hello Component B') this.$router.push('/bbb') } } } </script> component B: <template> <div> <p>component B:{{ msg }

2021-05-10 22:40:13    分类:问答    javascript   vuejs2   event-handling   vue-cli-3   event-bus

Loading preload script in Electron and Vue

I am using Vue CLI 3 and vue-cli-plugin-electron-builder to package my Vue Electron app and I am not able to get my preload.js script for electron working. main window win = new BrowserWindow({ width: 800, height: 600 webPreferences: { nodeIntegration: false, preload: path.join(__dirname, "/../src/preload.js") // works but window.electron.dialog in undefined } }); preload.js const { dialog } = require("electron"); window.electron = {}; window.electron.dialog = dialog; The window.electron.dialog is always undefined in my Vue component - the import is clearly not working. Note that window

2021-05-03 04:20:46    分类:问答    vue.js   electron   vue-cli-3   electron-builder

Vuejs image src dynamic load doesn't work

I just started using Vue.js and Vue CLI and i'm facing an issue, i don't understand why i can't set the image dynamically from the scope but i can do it writing it directly in the HTML, obj.img is a string with @/assets/logo.png value too. I have a timeout faking an ajax call, but the browser does not resolve properly the routes for the image. <div slot="media"> <img :src="obj.img"> <!-- http://localhost:8080/@/assets/logo.png --> <img src="@/assets/logo.png"> <!-- http://localhost:8080/img/logo.82b9c7a5.png --> </div> Also, why are the routes different? Any ideas?

2021-04-30 10:01:02    分类:问答    vue.js   vue-cli-3

Vue Cli 3 Local fonts not loading

When trying to load custom local fonts in Vue CLI 3 the fonts still will not appear. I am not receiving any error messages. The inspector shows the correct rule being loaded, but fonts are falling back to serif on #app. Fonts are not showing up in my dist folder anywhere. I have tried adding loaders in vue.config.js, changing url paths, and moving the @font-face rules around to different locations, changing the public path to ' ' and '/', importing scss into main.js. Font loading: @font-face { font-family: 'OpenSans-Regular'; src: url('/assets/fonts/OpenSans-Regular.eot'); src: url('/assets

2021-04-28 22:44:30    分类:问答    vue.js   fonts   vue-cli   vue-cli-3   webpack-file-loader