Vite - Quick Tips #1
05/01/2022, Sun
                        Categories:
                        
                        
                            #Tooling
                        
                        
                        
                            #javascript
                        
                        
                    
                
                
                    
                        Tags:
                        
                        
                            #frontend
                        
                        
                    
                
            More Log Information when Vite Server Runs
Using the -d option with the Vite command in the npm script to have
more verbose output for debugging.
// ...
    "scripts": {
        "dev": "vite -d",
        "build": "vite build",
        "preview": "vite preview"
    }
// ...
Launch the Vite Server Programmatically
Using the JavaScript API, the Vite server can be dynamically configured with custom options.
const { createServer } = require('vite');
(async () => {
  const server = await createServer({
  // any valid user config options, plus `mode` and `configFile`
  configFile: false,
  root: __dirname,
  server: {
    port: 8080
  }
});
await server.listen();
server.printUrls();
})();