webpack-simple routing not working in production mode - vue-router

I am using webpack-simple template for development with vue-js 2. I am using routing throug vue-router. It works fine in the development mode
npm run dev
After building, I got build.js in the dist folder using the below command
npm run build
With index.html and dist folder, I try to run the project but fail. No error found in the console also

Related

Why do I have blank page when serving VueJS 3 build with ExpressJS?

I have a web application, coded with VueJS 3, that runs well with npm run serve and npm run build; npx serve -s dist.
My problem is that, when serving the build files with ExpressJS and my NodeJS application, I can see in my browser that I successfuly downloaded all the required elements, but the only thing I get is a blank page, with no error.
I expect to see my application working, as it does with serve, or npm run serve. I launch my NodeJS application with npm run dev. Is it a problem?

vue app not working after npm run build for production

So I created a simple app with vue and works as I expected. But since I ran npm run build and I tried to run that project from /dist directory(for produnction) I just stops. What am i missing here guys?

Nuxt: Command 'nuxt' not found - Output directory `dist/` does not exists

I have successfully created a Nuxt.js project with this configuration using the CLI:
Project name: test
Programming language: JavaScript
Package manager: Npm
UI framework: None
Nuxt.js modules: None
Linting tools: None
Testing framework: None
Rendering mode: Single Page App
Deployment target: Static (Static/JAMStack hosting)
Development tools: jsconfig.json
Version control system: Git
The developement server runs properly with npm run dev.
npm run build also runs without errors and tells me that:
Ready to run nuxt generate
But the execution of nuxt generate leads to the error Command 'nuxt' not found. This is strange because nuxt seems to be installed when I execute npm nuxt list.
I first reinstalled just nuxt and then all dependencies after deleting the node_modules/ folder, but the error remains the same. If I just run npm run start it tells me
Nuxt Fatal Error
Error: Output directory `dist/` does not exists, please use
`nuxt generate` before `nuxt start` for static target.
This is strange again because the .nuxt/dist/ folder exists.
Does anyone have an idea what is going wrong?
I have solved the problem. For me it works if I run npm run generate instead of nuxt generate.

Creating build after every change in vuejs2

Is there any command or webpack task for creating build/dist of vuejs project.
Like right now we have to run command
npm run build
for creating build to deploy our app. I want something which will create dist folder after every change in code (src folder)
PS: I want similar command like in angular2 ng serve --prod which will serve code along with dist folder.

Run a Vue.js project in server without " npm run dev " command?

After installing vue cli globally by running npm install -g vue-cli, I have installed all the modules in the project folder "myBlog" by running npm install and can run the project in my local environment by using npm run dev. But when I am going to move this project in the live server is this is the right way to run the batch program (npm run dev) continuously or there are other ways to run the project without running npm run dev continuously?
It's not Vue specific but you also should be able to run npm run build which generates production bundles in /dist subfolder of your project. You are supposed to copy this folder to the production server and configure the server so that it serves dist/index.html for every URL.
If you are using the "webpack", "webpack-simple" or "pwa" template there is a dedicated command for creating the production build, which allows a static hosting (with no need to run any npm process in the server):
npm run build
It will create a dist folder which content you can upload to the root of your server.
Some more info about:
"webpack" template:
https://vuejs-templates.github.io/webpack/commands.html#npm-run-build
"webpack-simple":
https://github.com/vuejs-templates/webpack-simple#webpack-simple
"pwa": https://github.com/vuejs-templates/pwa#whats-included
Very simple. To launch a VueJs project, you must type "npm run serve".