vue-cli

Keeping asset and public path different in vue app for CDN

大城市里の小女人 提交于 2020-08-10 18:30:06
问题 vue has this option publicPath which lets an app to be deployed on subpath: foobar.com/my-path , making links and every asset accessible via it. From performance standpoint, I want to enable CDN on my application's assets. How can I use the URL specifically for assets (and not the hyperlinks)? Example: ./my-path/assets/app.js should become https://my-staging-cdn.com/my-path/assets/app.js ./my-path/url-2.html should remain the same The configuration below allows me to set the path and assets

How to create a multipage Vue.js application with pages on nested subdirectories by modifying vue.config.js?

拜拜、爱过 提交于 2020-07-22 05:52:31
问题 I have a multipage Vue.js application with working pages on domain/legal; domain/submit; etc. I've implemented that with the help of Vue.js' pages (i.e. customizing config.vue.js ) In other words, I'm all good making the above work. I'm now trying to implement further nested pages under a new subdirectory level (additionally to the ones I already have as per above). i.e. domain/org/profile1 domain/org/profile2 domain/org/profile3 Any way to make this work by customizing config.vue.js ?

Vue CLI's type checking service ignores memory limits

谁都会走 提交于 2020-07-18 04:39:25
问题 DevOps has requested that we limit our frontend builds to ~1GB of RAM, so that our Jenkins instance doesn't shut down. We use a standard @vue/cli project, with TypeScript. However, the TS type checking service ignores all attempts to limit its memory usage, which is always 2048 MB. I've tried disabling it and relying on fork-ts-checker-webpack-plugin but that introduces other problems. Based on what I found, this should work: $ NODE_OPTIONS=--max_old_space_size=1024 \ NODE_ENV=production \

How can I keep number and increment in child component with Vue JS?

孤街醉人 提交于 2020-07-10 01:55:52
问题 Practicing to make a todo application with Vue JS Input items save in the localStrage. UPDATED When you have some added list and reload a page, ID number start from 1(defalut). Ideal behaviour: when reload a page, ID number continues number increment. if some items removed, then, add new item, ID number should be the biggest ID number in array(if 8) +1 (should be 9). My code: Link Problem is around here. Child2.vue created() { let keyObject = JSON.parse(localStorage.getItem(this.keyName)); if

Vue.js Error “Cannot find module './undefined'” from webpack when using src=require()

做~自己de王妃 提交于 2020-07-07 12:01:31
问题 I am trying to load images from a local folder using the src="" from the img tag but I want to load them using the backend. The frontend already has the relative path which is "../assets/imgs/" the backend just has the name and extension ex) "1.png". Thing is that it does work but I'm getting error messages. This is causing me an issue <img width=100px height=100px :src="getIconPath(`${user.icon}`)"/> here is the function that gets called methods: { getIconPath(iconName) { return iconName ?

Vue CLI build and run index.html file without server

佐手、 提交于 2020-06-24 08:25:45
问题 I'm using the latest vue-cli version 3.0. My current issue is that whenever I run npm run build the files generated in the dist folder can't be run without a server. I would like to be able to just open the index.html file on the browser. How do I go about doing this? 回答1: I ran into a similar issue and the following two changes helped me to make it work. Now I can just open index.html in Chrome as a file to run my SPA from file system . In vue.config.js, I did not have a publicPath

How to change basepath on deployment of Vue app

徘徊边缘 提交于 2020-05-24 04:35:16
问题 I have a Vue 2.0 webapplication that runs without problems on my computer, but I can't seem to get it to work on a server without the app running on the root directory. e.g: ' www.someserver.com/my-app/ ' instead of ' www.someserver.com/ '. I used the webpack-simple template which has this basic webpack configuration. How can I make sure that the app will load the files from the folder instead of the root? 回答1: Assuming your server is already serving your html/js bundles when you go to the

vue-cli-service build --target lib loses images path when imported as lib

泪湿孤枕 提交于 2020-05-10 14:29:21
问题 I followed this guide to create my npm module. My repo contains in the src/assets folder an svg image (hue-cirle.svg). When building with vue-cli-service build --target lib --name <lib-name> the svg image is bundled under dist/img/hue-circle123456.svg . Now when installing the module with npm install --save <module> the path remains src/img/hue-circle123456.svg , while it should refer to the svg image from the node_modules dist folder and not to a non-existing hue-circle123456.svg image from

Vue dist path for CSS and JS not found

北城余情 提交于 2020-05-07 08:17:21
问题 I am having trouble rendering my VueJS application after build. When I look in the build folder and examine the paths, there is a forward slash at the beginning of my paths to my assets, css and javascript. This makes it so my css, assets and javascript cannot be found. I am wondering how, before I run the build script, I can avoid this issue. Thank you. Here is my code: App.vue <template> <div id="app"> <BaseTimer /> <!-- <PomodoroTimer /> --> </div> </template> <script> import BaseTimer