This template is built for multi-page application(MPA). If you want to create a new project with SPA, see template-webpack or webpack_svelte.
To create a new project based on this template using degit:
npx degit brandonxiang/svelte-webpack-mpa svelte-app
cd svelte-app
yarn
# or
npm i
Your static files can be placed into public
folder.
yarn dev
# or
npm run dev
http://localhost:9000/page1.html
is the first page. http://localhost:9000/page2.html
is the second page.
Because of the extremely small bundle size of Svelte App, the common chunk for multi-pages is unneccessary to build. Each page has its own js bundle, or you can change webpack config by yourself.
yarn build
# or
npm run build
yarn analyze
# or
npm run analyze
Preprocess is the most interesting API of svelte. Therefore, svelte-preprocess is included in the project. Postcss is essential for autoprefixer. Other style preprocessers, like sass, could be setted by yourself.
- babel is not essential. So we remove babel-loader
MIT @brandonxiang