Reputation: 43
Hi guys i am new to Svelte and i have a question.
I have made a small app in svelte that runs smoothly in dev.
But when i am running npm run build
for production
the output in the public folder are 3 itemsbundle.css
bundle.js
and bundle.js.map
There is no index.html
Can anyone please help me because as it seems the public folder should have the index.html in it.
Upvotes: 1
Views: 3277
Reputation: 419
The public folder should contain a subfolder named "build", inside that folder is where the bundle files should be located. Your static assets, the index.html file, and service-worker.js (if used) should reside in the public folder along side the build folder.
Setup a base project again and look for the index.html file in the public folder before writing a single line of code.
$ npx degit sveltejs/template my-svelte-project
$ cd my-svelte-project
$ npm install
$ npm run dev
Upvotes: 0
Reputation: 43
So i found my answer. After i builded the proj, i pasted in the webhost all the items from public folder(assets,build,rest of items) and it worked . It was an issue with host also.
Upvotes: 1
Reputation: 16411
The starter template assumes the index.html and all other static files (favicon, images, ...) are already in your public folder. They do not get any special treatment from the build script. If you want to copy extra files during build you can use special plugins for that.
rollup-plugin-copy-assets could be an option
Upvotes: 1