Commit db22f051 authored by Aral Balkan's avatar Aral Balkan
Browse files

Move from Snowpack to Vite

parent 728b8b43
......@@ -3,9 +3,8 @@
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Sign in spike</title>
<script type="text/javascript">window.HMR_WEBSOCKET_PORT=444</script>
<script type='module' src='index.js'></script>
<title>Henry: Small Web Reference Client</title>
<script src='./index.js' type='module'></script>
</head>
<body>
<div id='svelte'></div>
......
......@@ -2,6 +2,10 @@ import './index.css'
import Index from './Index.svelte'
import { Buffer } from 'buffer'
globalThis.Buffer = Buffer
new Index({
target: document.getElementById('svelte')
})
......@@ -13,10 +13,13 @@
"author": "",
"license": "ISC",
"dependencies": {
"@rollup/plugin-html": "^0.2.3",
"@snowpack/plugin-svelte": "^3.5.2",
"blakejs": "^1.1.0",
"buffer": "^6.0.3",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-sri": "^1.2.7",
"session25519": "^1.1.0",
"svelte": "^3.32.3",
"svelte-hmr": "^0.12.6",
"svelte-loading-spinners": "^0.1.4",
"svelte-switch": "0.0.4",
......@@ -25,6 +28,9 @@
"tweetnacl-util": "^0.15.1"
},
"devDependencies": {
"snowpack": "^3.0.11"
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.5",
"snowpack": "^3.1.2",
"svelte": "^3.35.0",
"vite": "^2.1.3"
}
}
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
/* ... */
},
exclude: ['**/node_modules/**/*', '.git/**', 'build.js'],
plugins: [
['@snowpack/plugin-svelte'],
],
packageOptions: {
polyfillNode: true
},
devOptions: {
// output: 'stream', // Don’t clear terminal.
open: 'none',
secure: true,
port: 444,
},
buildOptions: {
out: '../henry-dist'
},
optimize: {
bundle: true,
minify: true,
target: 'es2020',
},
}
import os from 'os'
import fs from 'fs'
import path from 'path'
import { defineConfig } from 'vite'
import svelte from '@sveltejs/vite-plugin-svelte'
import sri from 'rollup-plugin-sri'
import html from '@rollup/plugin-html'
const certDirectory = path.join(os.homedir(), '.small-tech.org', 'auto-encrypt-localhost')
const cert = fs.readFileSync(path.join(certDirectory, 'localhost.pem'))
const key = fs.readFileSync(path.join(certDirectory, 'localhost-key.pem'))
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
server: {
port: 444,
https: {key, cert}
},
build: {
outDir: 'dist',
rollupOptions: {
plugins: [html(), sri()]
}
}
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment