Creating a Build
In other books about web development frameworks, a section related to creating a production build of the application usually doesn’t come until the very end. But because SvelteKit and Vite make it so simple, there’s really no reason to wait. I’m sure you’re eager to get your application available as soon as possible, so let’s get straight to it.
So far, we’ve only worked with our application in the development environment. In essence, Vite started a development server on the local machine when we ran the npm run dev
command. To shut down the development server, we use Ctrl + C. To prepare a production build of our application, we can use the provided npm
script:
npm run build
If you open the project’s package.json
, you’ll notice this particular script runs the vite build
command. It does exactly what it sounds like by kicking off Vite’s build process, which involves the bundling process from Rollup...