Is there any environment variable to set up for my Vite app deployed on Netlify. When I use npm run dev on localhost, my site is rendered as expected, but when I use the same build command on Netlify, it just renders the pure HTML page without using the Vite main.js. I include my link to my project here: https://github.com/nguyenvothuan/Portfolio/tree/master and to netlify: https://quizzical-jepsen-e78ac7.netlify.app/
Update: Set the following:
build command: npm run build (not npm run dev)
publish directory: dist
some background:this is my first react application and my assumption is build in react is similar to binary files in c++
question : this is for a react application which sole purpose is to run locally. is there anyway we can do npm start only with build
have tried to delete the src folder after building.
expected result is the app should run as usual.
actual result : app crashes saying, index.js file is missing
npm start won`t work with build version,
you need to install serve and run build using serve locally on your machine
npm install -g serve
serve -s build
ref: https://facebook.github.io/create-react-app/docs/deployment
I want to build the default template of Vue.js
vue init webpack
with this command
node build/build.js
Instead of having the same page that I have when running npm run dev I have a blank page.
Also I run npm run build
How to convert this site into a non-develop website ?
Vue version 2.9.6
Node version v8.15.1
working with angular2 App, and i am writing .bat scripts to automate the angular build and serving the application, as part of the ng serve. I have to do like
c:\abc\edf>ng serve --server=d:\angualr2\demoApp
Here demoApp is angular2 and node_modules already installed i need to up the angulap app by my batch script.
Where as everyone knows it works and working for me too.
d:\angualr2\demoApp>ng serve
if you build the application, then you don't serve it with ng serve
the flag --server is unknown to me, and to the CLI documentation (--help)
If you have a path issue, start by goign into the right folder of your file explorer with cd D:\angular2\demoApp (not sure about it, I'm more of a Linux man)
ng works because NPM added it to your PATH. If you work on another computer, it won't work. Consider running with the local package with a npm command such as npm run build, where build: "ng build --prod"
I'm a little uncertain about some Angular 5 aspects. I've developed an app and don't know how to run it on production.
Currently I run my app using ng serve in NodeJS , but is it same in a production environment ?
thanks!
ng serve
ng serve is for development purpose. Check docs.
When using ng serve the compiled output is served from memory, not from disk.
This means that the application being served is not located on disk in the dist folder.
ng build
ng build --prod is for production purpose. Check docs.
ng build compiles the application into an output directory.
The build artifacts will be stored in the dist/ directory, inside the root directory of your angular app.
Jus copy the dist folder to any server like IIS or Node Express and your angular app is up and running.
To deploy you app using IIS check this and using Node Express check this.
Generally, I do not use Angular CLI's built in web server for production deployments.
With Angular CLI, you can create a production build using this command
ng build –prod
That will create a dist folder, which you can upload to any web server of your choosing to deploy an application.
First and foremost, you should build your app for production using
ng build --prod
You'll find a dist folder in your project folder. This is the Production-ready version of your app.
Now you'd require a server to deploy your app. Install this - https://www.npmjs.com/package/http-server and run using http-server dist/myProject (replace myProject with your project name)
ng build generate production files in outDir folder.
To know where it is, go to .angular-cli.json file and see apps > outDir property. For example:
"apps": [
{
"root": "src",
"outDir": "../../webapp/recorder",
"assets": [
"assets",
"favicon.ico"
],
...
These files are only html, css and javascript and can be used on any web server
Follow this instruction by using Angular CLI:
1- Build your project (for production mode)
ng build --prod
2- If you want to see your project in production mode before deploy it on the real server you can use lite-server to serve your project in a local machine.
First install lite-server
npm i lite-server --save-dev
And then run your project on local server
lite-server --baseDir="dist/your-project-name"