mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-11 18:14:27 +00:00
Merge pull request #3 from sveltejs/master
update to last sapper version
This commit is contained in:
18
.github/workflows/build-templates.yml
vendored
Normal file
18
.github/workflows/build-templates.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: Create templates
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
-
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
SSH_KEY: ${{ secrets.SSH_KEY }}
|
||||||
|
SSH_KEY_ROLLUP: ${{ secrets.SSH_KEY_ROLLUP }}
|
||||||
|
SSH_KEY_WEBPACK: ${{ secrets.SSH_KEY_WEBPACK }}
|
||||||
|
run: _template/build.sh
|
||||||
11
.travis.yml
11
.travis.yml
@@ -1,11 +0,0 @@
|
|||||||
sudo: false
|
|
||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- "stable"
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- BUILD_TIMEOUT=10000
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
script: _template/build.sh
|
|
||||||
39
README.md
39
README.md
@@ -1,14 +1,35 @@
|
|||||||
# sapper-template
|
# sapper-template
|
||||||
|
|
||||||
The default [Sapper](https://github.com/sveltejs/sapper) template, with branches for Rollup and webpack. To clone it and get started:
|
The default [Sapper](https://github.com/sveltejs/sapper) template, available for Rollup and webpack.
|
||||||
|
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
|
||||||
|
### Using `degit`
|
||||||
|
|
||||||
|
[`degit`](https://github.com/Rich-Harris/degit) is a scaffolding tool that lets you create a directory from a branch in a repository. Use either the `rollup` or `webpack` branch in `sapper-template`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# for Rollup
|
# for Rollup
|
||||||
npx degit "sveltejs/sapper-template#rollup" my-app
|
npx degit "sveltejs/sapper-template#rollup" my-app
|
||||||
# for webpack
|
# for webpack
|
||||||
npx degit "sveltejs/sapper-template#webpack" my-app
|
npx degit "sveltejs/sapper-template#webpack" my-app
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Using GitHub templates
|
||||||
|
|
||||||
|
Alternatively, you can use GitHub's template feature with the [sapper-template-rollup](https://github.com/sveltejs/sapper-template-rollup) or [sapper-template-webpack](https://github.com/sveltejs/sapper-template-webpack) repositories.
|
||||||
|
|
||||||
|
|
||||||
|
### Running the project
|
||||||
|
|
||||||
|
However you get the code, you can install dependencies and run the project in development mode with:
|
||||||
|
|
||||||
|
```bash
|
||||||
cd my-app
|
cd my-app
|
||||||
npm install # or yarn!
|
npm install # or yarn
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -46,7 +67,7 @@ There are three simple rules for naming the files that define your routes:
|
|||||||
|
|
||||||
The [static](static) directory contains any static assets that should be available. These are served using [sirv](https://github.com/lukeed/sirv).
|
The [static](static) directory contains any static assets that should be available. These are served using [sirv](https://github.com/lukeed/sirv).
|
||||||
|
|
||||||
In your [service-worker.js](app/service-worker.js) file, you can import these as `files` from the generated manifest...
|
In your [service-worker.js](src/service-worker.js) file, you can import these as `files` from the generated manifest...
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { files } from '@sapper/service-worker';
|
import { files } from '@sapper/service-worker';
|
||||||
@@ -64,19 +85,21 @@ Sapper uses Rollup or webpack to provide code-splitting and dynamic imports, as
|
|||||||
|
|
||||||
To start a production version of your app, run `npm run build && npm start`. This will disable live reloading, and activate the appropriate bundler plugins.
|
To start a production version of your app, run `npm run build && npm start`. This will disable live reloading, and activate the appropriate bundler plugins.
|
||||||
|
|
||||||
You can deploy your application to any environment that supports Node 8 or above. As an example, to deploy to [Now](https://zeit.co/now), run these commands:
|
You can deploy your application to any environment that supports Node 10 or above. As an example, to deploy to [Vercel Now](https://vercel.com) when using `sapper export`, run these commands:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install -g now
|
npm install -g vercel
|
||||||
now
|
vercel
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If your app can't be exported to a static site, you can use the [now-sapper](https://github.com/thgh/now-sapper) builder. You can find instructions on how to do so in its [README](https://github.com/thgh/now-sapper#basic-usage).
|
||||||
|
|
||||||
## Using external components with webpack
|
|
||||||
|
## Using external components
|
||||||
|
|
||||||
When using Svelte components installed from npm, such as [@sveltejs/svelte-virtual-list](https://github.com/sveltejs/svelte-virtual-list), Svelte needs the original component source (rather than any precompiled JavaScript that ships with the component). This allows the component to be rendered server-side, and also keeps your client-side app smaller.
|
When using Svelte components installed from npm, such as [@sveltejs/svelte-virtual-list](https://github.com/sveltejs/svelte-virtual-list), Svelte needs the original component source (rather than any precompiled JavaScript that ships with the component). This allows the component to be rendered server-side, and also keeps your client-side app smaller.
|
||||||
|
|
||||||
Because of that, it's essential that webpack doesn't treat the package as an *external dependency*. You can either modify the `externals` option under `server` in [webpack.config.js](webpack.config.js), or simply install the package to `devDependencies` rather than `dependencies`, which will cause it to get bundled (and therefore compiled) with your app:
|
Because of that, it's essential that the bundler doesn't treat the package as an *external dependency*. You can either modify the `external` option under `server` in [rollup.config.js](rollup.config.js) or the `externals` option in [webpack.config.js](webpack.config.js), or simply install the package to `devDependencies` rather than `dependencies`, which will cause it to get bundled (and therefore compiled) with your app:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install -D @sveltejs/svelte-virtual-list
|
npm install -D @sveltejs/svelte-virtual-list
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd "$(dirname $0)"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
if [ "$CI" ]; then
|
if [ "$CI" ]; then
|
||||||
# write out SSH key
|
(umask 0077; echo "$SSH_KEY" > ~/ssh_key; echo "$SSH_KEY_ROLLUP" > ~/ssh_key_rollup; echo "$SSH_KEY_WEBPACK" > ~/ssh_key_webpack)
|
||||||
[ "$SSH_KEY" ] || exit 1
|
git config user.email 'noreply@svelte.dev'
|
||||||
echo "$SSH_KEY" > ~/.ssh/id_rsa
|
git config user.name '[bot]'
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# branch names
|
# branch names
|
||||||
DEFAULT=master
|
|
||||||
ROLLUP=rollup
|
ROLLUP=rollup
|
||||||
WEBPACK=webpack
|
WEBPACK=webpack
|
||||||
|
|
||||||
./create-branches.sh $DEFAULT $ROLLUP $WEBPACK
|
./create-branches.sh $ROLLUP $WEBPACK
|
||||||
|
|
||||||
# force push rollup and webpack branches
|
# force push rollup and webpack branches and repos
|
||||||
git push git@github.com:sveltejs/sapper-template.git $ROLLUP $WEBPACK -f
|
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new -i ~/ssh_key' git push git@github.com:sveltejs/sapper-template.git $ROLLUP $WEBPACK -f
|
||||||
|
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new -i ~/ssh_key_rollup' git push git@github.com:sveltejs/sapper-template-rollup.git $ROLLUP:master -f
|
||||||
|
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new -i ~/ssh_key_webpack' git push git@github.com:sveltejs/sapper-template-webpack.git $WEBPACK:master -f
|
||||||
|
|||||||
@@ -1,31 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd "$(dirname $0)"/..
|
cd "$(dirname "$0")"/..
|
||||||
|
|
||||||
DEFAULT=${1:-master}
|
HEAD=$(git rev-parse HEAD)
|
||||||
ROLLUP=${2:-rollup}
|
|
||||||
WEBPACK=${3:-webpack}
|
|
||||||
|
|
||||||
echo "Creating $ROLLUP and $WEBPACK branches from $DEFAULT"
|
ROLLUP=${1:-rollup}
|
||||||
|
WEBPACK=${2:-webpack}
|
||||||
|
|
||||||
# make sure we're on master, and delete the $ROLLUP and $WEBPACK branches
|
echo "Creating $ROLLUP and $WEBPACK branches from $REV"
|
||||||
git symbolic-ref HEAD "refs/heads/$DEFAULT"
|
|
||||||
git reset --hard
|
|
||||||
git branch -D $ROLLUP $WEBPACK
|
|
||||||
|
|
||||||
# create the $ROLLUP branch off the current master
|
# create the $ROLLUP branch off the current HEAD
|
||||||
git checkout -b $ROLLUP
|
git symbolic-ref HEAD refs/heads/$ROLLUP
|
||||||
|
git reset $HEAD --hard
|
||||||
node _template/build-pkg.js rollup
|
node _template/build-pkg.js rollup
|
||||||
git rm -r --cached .travis.yml _template package_template.json webpack.config.js
|
git rm -r --cached .github _template package_template.json webpack.config.js
|
||||||
git add package.json
|
git add package.json
|
||||||
git commit -m 'Sapper template for Rollup'
|
git commit -m 'Sapper template for Rollup'
|
||||||
git symbolic-ref HEAD "refs/heads/$DEFAULT"
|
|
||||||
git reset --hard
|
|
||||||
|
|
||||||
# create the $WEBPACK branch off the current master
|
# create the $WEBPACK branch off the current HEAD
|
||||||
git checkout -b $WEBPACK
|
git symbolic-ref HEAD refs/heads/$WEBPACK
|
||||||
|
git reset $HEAD --hard
|
||||||
node _template/build-pkg.js webpack
|
node _template/build-pkg.js webpack
|
||||||
git rm -r --cached .travis.yml _template package_template.json rollup.config.js
|
git rm -r --cached .github _template package_template.json rollup.config.js
|
||||||
git add package.json
|
git add package.json
|
||||||
git commit -m 'Sapper template for webpack'
|
git commit -m 'Sapper template for webpack'
|
||||||
git symbolic-ref HEAD "refs/heads/$DEFAULT"
|
|
||||||
git reset --hard
|
|
||||||
18
appveyor.yml
18
appveyor.yml
@@ -1,18 +0,0 @@
|
|||||||
version: "{build}"
|
|
||||||
|
|
||||||
shallow_clone: true
|
|
||||||
|
|
||||||
init:
|
|
||||||
- git config --global core.autocrlf false
|
|
||||||
|
|
||||||
build: off
|
|
||||||
|
|
||||||
environment:
|
|
||||||
matrix:
|
|
||||||
# node.js
|
|
||||||
- nodejs_version: stable
|
|
||||||
|
|
||||||
install:
|
|
||||||
- ps: Install-Product node $env:nodejs_version
|
|
||||||
- npm install cypress
|
|
||||||
- npm install
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"compression": "^1.7.1",
|
"compression": "^1.7.1",
|
||||||
"polka": "^0.5.0",
|
"polka": "next",
|
||||||
"sirv": "^0.4.0"
|
"sirv": "^0.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -33,13 +33,13 @@
|
|||||||
"@babel/plugin-transform-runtime": "^7.0.0",
|
"@babel/plugin-transform-runtime": "^7.0.0",
|
||||||
"@babel/preset-env": "^7.0.0",
|
"@babel/preset-env": "^7.0.0",
|
||||||
"@babel/runtime": "^7.0.0",
|
"@babel/runtime": "^7.0.0",
|
||||||
"rollup": "^1.0.0",
|
"@rollup/plugin-babel": "^5.0.0",
|
||||||
"rollup-plugin-babel": "^4.0.2",
|
"@rollup/plugin-commonjs": "^12.0.0",
|
||||||
"rollup-plugin-commonjs": "^9.1.6",
|
"@rollup/plugin-node-resolve": "^8.0.0",
|
||||||
"rollup-plugin-node-resolve": "^4.0.0",
|
"@rollup/plugin-replace": "^2.2.0",
|
||||||
"rollup-plugin-replace": "^2.0.0",
|
"rollup": "^2.3.4",
|
||||||
"rollup-plugin-svelte": "^5.0.1",
|
"rollup-plugin-svelte": "^5.0.1",
|
||||||
"rollup-plugin-terser": "^4.0.4"
|
"rollup-plugin-terser": "^5.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"webpack": {
|
"webpack": {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import resolve from 'rollup-plugin-node-resolve';
|
import resolve from '@rollup/plugin-node-resolve';
|
||||||
import replace from 'rollup-plugin-replace';
|
import replace from '@rollup/plugin-replace';
|
||||||
import commonjs from 'rollup-plugin-commonjs';
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
import svelte from 'rollup-plugin-svelte';
|
import svelte from 'rollup-plugin-svelte';
|
||||||
import babel from 'rollup-plugin-babel';
|
import babel from '@rollup/plugin-babel';
|
||||||
import { terser } from 'rollup-plugin-terser';
|
import { terser } from 'rollup-plugin-terser';
|
||||||
import config from 'sapper/config/rollup.js';
|
import config from 'sapper/config/rollup.js';
|
||||||
import pkg from './package.json';
|
import pkg from './package.json';
|
||||||
@@ -28,13 +28,14 @@ export default {
|
|||||||
emitCss: true
|
emitCss: true
|
||||||
}),
|
}),
|
||||||
resolve({
|
resolve({
|
||||||
browser: true
|
browser: true,
|
||||||
|
dedupe: ['svelte']
|
||||||
}),
|
}),
|
||||||
commonjs(),
|
commonjs(),
|
||||||
|
|
||||||
legacy && babel({
|
legacy && babel({
|
||||||
extensions: ['.js', '.mjs', '.html', '.svelte'],
|
extensions: ['.js', '.mjs', '.html', '.svelte'],
|
||||||
runtimeHelpers: true,
|
babelHelpers: 'runtime',
|
||||||
exclude: ['node_modules/@babel/**'],
|
exclude: ['node_modules/@babel/**'],
|
||||||
presets: [
|
presets: [
|
||||||
['@babel/preset-env', {
|
['@babel/preset-env', {
|
||||||
@@ -54,6 +55,7 @@ export default {
|
|||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|
||||||
|
preserveEntrySignatures: false,
|
||||||
onwarn,
|
onwarn,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -69,13 +71,16 @@ export default {
|
|||||||
generate: 'ssr',
|
generate: 'ssr',
|
||||||
dev
|
dev
|
||||||
}),
|
}),
|
||||||
resolve(),
|
resolve({
|
||||||
|
dedupe: ['svelte']
|
||||||
|
}),
|
||||||
commonjs()
|
commonjs()
|
||||||
],
|
],
|
||||||
external: Object.keys(pkg.dependencies).concat(
|
external: Object.keys(pkg.dependencies).concat(
|
||||||
require('module').builtinModules || Object.keys(process.binding('natives'))
|
require('module').builtinModules || Object.keys(process.binding('natives'))
|
||||||
),
|
),
|
||||||
|
|
||||||
|
preserveEntrySignatures: 'strict',
|
||||||
onwarn,
|
onwarn,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -92,6 +97,7 @@ export default {
|
|||||||
!dev && terser()
|
!dev && terser()
|
||||||
],
|
],
|
||||||
|
|
||||||
|
preserveEntrySignatures: false,
|
||||||
onwarn,
|
onwarn,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,12 +26,12 @@
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected {
|
[aria-current] {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected::after {
|
[aria-current]::after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: '';
|
content: '';
|
||||||
width: calc(100% - 1em);
|
width: calc(100% - 1em);
|
||||||
@@ -50,11 +50,11 @@
|
|||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a class='{segment === undefined ? "selected" : ""}' href='.'>home</a></li>
|
<li><a aria-current="{segment === undefined ? 'page' : undefined}" href=".">home</a></li>
|
||||||
<li><a class='{segment === "about" ? "selected" : ""}' href='about'>about</a></li>
|
<li><a aria-current="{segment === 'about' ? 'page' : undefined}" href="about">about</a></li>
|
||||||
|
|
||||||
<!-- for the blog link, we're using rel=prefetch so that Sapper prefetches
|
<!-- for the blog link, we're using rel=prefetch so that Sapper prefetches
|
||||||
the blog data when we hover over the link or tap it on a touchscreen -->
|
the blog data when we hover over the link or tap it on a touchscreen -->
|
||||||
<li><a rel=prefetch class='{segment === "blog" ? "selected" : ""}' href='blog'>blog</a></li>
|
<li><a rel=prefetch aria-current="{segment === 'blog' ? 'page' : undefined}" href="blog">blog</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script context="module">
|
<script context="module">
|
||||||
export async function preload({ params, query }) {
|
export async function preload({ params, query }) {
|
||||||
// the `slug` parameter is available because
|
// the `slug` parameter is available because
|
||||||
// this file is called [slug].html
|
// this file is called [slug].svelte
|
||||||
const res = await this.fetch(`blog/${params.slug}.json`);
|
const res = await this.fetch(`blog/${params.slug}.json`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
@@ -61,4 +61,4 @@
|
|||||||
|
|
||||||
<div class='content'>
|
<div class='content'>
|
||||||
{@html post.html}
|
{@html post.html}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ const posts = [
|
|||||||
title: 'How is Sapper different from Next.js?',
|
title: 'How is Sapper different from Next.js?',
|
||||||
slug: 'how-is-sapper-different-from-next',
|
slug: 'how-is-sapper-different-from-next',
|
||||||
html: `
|
html: `
|
||||||
<p><a href='https://github.com/zeit/next.js'>Next.js</a> is a React framework from <a href='https://zeit.co'>Zeit</a>, and is the inspiration for Sapper. There are a few notable differences, however:</p>
|
<p><a href='https://github.com/zeit/next.js'>Next.js</a> is a React framework from <a href='https://vercel.com/'>Vercel</a>, and is the inspiration for Sapper. There are a few notable differences, however:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>It's powered by <a href='https://svelte.dev'>Svelte</a> instead of React, so it's faster and your apps are smaller</li>
|
<li>It's powered by <a href='https://svelte.dev'>Svelte</a> instead of React, so it's faster and your apps are smaller</li>
|
||||||
<li>Instead of route masking, we encode route parameters in filenames. For example, the page you're looking at right now is <code>src/routes/blog/[slug].html</code></li>
|
<li>Instead of route masking, we encode route parameters in filenames. For example, the page you're looking at right now is <code>src/routes/blog/[slug].svelte</code></li>
|
||||||
<li>As well as pages (Svelte components, which render on server or client), you can create <em>server routes</em> in your <code>routes</code> directory. These are just <code>.js</code> files that export functions corresponding to HTTP methods, and receive Express <code>request</code> and <code>response</code> objects as arguments. This makes it very easy to, for example, add a JSON API such as the one <a href='blog/how-is-sapper-different-from-next.json'>powering this very page</a></li>
|
<li>As well as pages (Svelte components, which render on server or client), you can create <em>server routes</em> in your <code>routes</code> directory. These are just <code>.js</code> files that export functions corresponding to HTTP methods, and receive Express <code>request</code> and <code>response</code> objects as arguments. This makes it very easy to, for example, add a JSON API such as the one <a href='blog/how-is-sapper-different-from-next.json'>powering this very page</a></li>
|
||||||
<li>Links are just <code><a></code> elements, rather than framework-specific <code><Link></code> components. That means, for example, that <a href='blog/how-can-i-get-involved'>this link right here</a>, despite being inside a blob of HTML, works with the router as you'd expect.</li>
|
<li>Links are just <code><a></code> elements, rather than framework-specific <code><Link></code> components. That means, for example, that <a href='blog/how-can-i-get-involved'>this link right here</a>, despite being inside a blob of HTML, works with the router as you'd expect.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -39,8 +39,8 @@
|
|||||||
<h1>Great success!</h1>
|
<h1>Great success!</h1>
|
||||||
|
|
||||||
<figure>
|
<figure>
|
||||||
<img alt='Borat' src='great-success.png'>
|
<img alt='Success Kid' src='successkid.jpg'>
|
||||||
<figcaption>HIGH FIVE!</figcaption>
|
<figcaption>Have fun with Sapper!</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<p><strong>Try editing this file (src/routes/index.svelte) to test live reloading.</strong></p>
|
<p><strong>Try editing this file (src/routes/index.svelte) to test live reloading.</strong></p>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html lang='en'>
|
||||||
<head>
|
<head>
|
||||||
<meta charset='utf-8'>
|
<meta charset='utf-8'>
|
||||||
<meta name='viewport' content='width=device-width,initial-scale=1.0'>
|
<meta name='viewport' content='width=device-width,initial-scale=1.0'>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
%sapper.base%
|
%sapper.base%
|
||||||
|
|
||||||
<link rel='stylesheet' href='global.css'>
|
<link rel='stylesheet' href='global.css'>
|
||||||
<link rel='manifest' href='manifest.json'>
|
<link rel='manifest' href='manifest.json' crossorigin='use-credentials'>
|
||||||
<link rel='icon' type='image/png' href='favicon.png'>
|
<link rel='icon' type='image/png' href='favicon.png'>
|
||||||
|
|
||||||
<!-- Sapper generates a <style> tag containing critical CSS
|
<!-- Sapper generates a <style> tag containing critical CSS
|
||||||
@@ -22,10 +22,10 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- The application will be rendered inside this element,
|
<!-- The application will be rendered inside this element,
|
||||||
because `app/client.js` references it -->
|
because `src/client.js` references it -->
|
||||||
<div id='sapper'>%sapper.html%</div>
|
<div id='sapper'>%sapper.html%</div>
|
||||||
|
|
||||||
<!-- Sapper creates a <script> tag containing `app/client.js`
|
<!-- Sapper creates a <script> tag containing `src/client.js`
|
||||||
and anything else it needs to hydrate the app and
|
and anything else it needs to hydrate the app and
|
||||||
initialise the router -->
|
initialise the router -->
|
||||||
%sapper.scripts%
|
%sapper.scripts%
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 80 KiB |
BIN
static/successkid.jpg
Executable file
BIN
static/successkid.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
@@ -1,10 +1,12 @@
|
|||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
const path = require('path');
|
||||||
const config = require('sapper/config/webpack.js');
|
const config = require('sapper/config/webpack.js');
|
||||||
const pkg = require('./package.json');
|
const pkg = require('./package.json');
|
||||||
|
|
||||||
const mode = process.env.NODE_ENV;
|
const mode = process.env.NODE_ENV;
|
||||||
const dev = mode === 'development';
|
const dev = mode === 'development';
|
||||||
|
|
||||||
|
const alias = { svelte: path.resolve('node_modules', 'svelte') };
|
||||||
const extensions = ['.mjs', '.js', '.json', '.svelte', '.html'];
|
const extensions = ['.mjs', '.js', '.json', '.svelte', '.html'];
|
||||||
const mainFields = ['svelte', 'module', 'browser', 'main'];
|
const mainFields = ['svelte', 'module', 'browser', 'main'];
|
||||||
|
|
||||||
@@ -12,7 +14,7 @@ module.exports = {
|
|||||||
client: {
|
client: {
|
||||||
entry: config.client.entry(),
|
entry: config.client.entry(),
|
||||||
output: config.client.output(),
|
output: config.client.output(),
|
||||||
resolve: { extensions, mainFields },
|
resolve: { alias, extensions, mainFields },
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
@@ -44,7 +46,7 @@ module.exports = {
|
|||||||
entry: config.server.entry(),
|
entry: config.server.entry(),
|
||||||
output: config.server.output(),
|
output: config.server.output(),
|
||||||
target: 'node',
|
target: 'node',
|
||||||
resolve: { extensions, mainFields },
|
resolve: { alias, extensions, mainFields },
|
||||||
externals: Object.keys(pkg.dependencies).concat('encoding'),
|
externals: Object.keys(pkg.dependencies).concat('encoding'),
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
|||||||
Reference in New Issue
Block a user