Compare commits
2 Commits
1273ef63f0
...
08ae9ebf08
Author | SHA1 | Date |
---|---|---|
|
08ae9ebf08 | |
|
52f376e6f1 |
|
@ -1,3 +1,2 @@
|
|||
.snowpack
|
||||
build
|
||||
node_modules
|
||||
dist
|
||||
node_modules
|
||||
|
|
|
@ -14,7 +14,7 @@ function createWindow() {
|
|||
if (process.env.NODE_ENV === 'production') {
|
||||
win.loadFile('./index.html');
|
||||
} else {
|
||||
win.loadURL('http://localhost:8080');
|
||||
win.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`);
|
||||
}
|
||||
|
||||
// Open the DevTools.
|
||||
|
@ -43,3 +43,7 @@ app.on('activate', () => {
|
|||
}
|
||||
});
|
||||
|
||||
// Webpack Hot Module Replacement (HMR)
|
||||
if (module.hot) {
|
||||
module.hot.accept()
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"main": "main.js"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,41 @@
|
|||
{
|
||||
"productName": "Accord",
|
||||
"name": "accord",
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"start": "npm run build && cross-env NODE_ENV=production electron ./build",
|
||||
"dev": "npm run build && concurrently --kill-others --success first \"snowpack dev --open none\" \"wait-on http://localhost:8080/ && electron ./build\"",
|
||||
"build": "snowpack build"
|
||||
"dev": "electron-webpack dev",
|
||||
"dev:nogpu": "electron-webpack dev --disable-gpu",
|
||||
"build": "electron-webpack",
|
||||
"dist": "npm run build && electron-builder",
|
||||
"dist:dir": "npm run dist --dir -c.compression=store -c.mac.identity=null"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@snowpack/plugin-svelte": "^3.5.2",
|
||||
"@snowpack/plugin-typescript": "^1.2.1",
|
||||
"@tsconfig/svelte": "^1.0.10",
|
||||
"@types/node": "^14.14.28",
|
||||
"builtin-modules": "^3.2.0",
|
||||
"concurrently": "^5.3.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"electron": "^11.2.3",
|
||||
"snowpack": "^3.0.1",
|
||||
"snowpack-plugin-selective-import-to-require": "^0.3.0",
|
||||
"electron-app-settings": "^1.2.2",
|
||||
"electron-builder": "^22.9.1",
|
||||
"electron-webpack": "^2.8.2",
|
||||
"electron-webpack-ts": "^4.0.1",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
"source-map-support": "^0.5.19",
|
||||
"stylus": "^0.54.8",
|
||||
"svelte": "^3.32.3",
|
||||
"svelte-loader-hot": "^0.3.1",
|
||||
"svelte-preprocess": "^4.6.9",
|
||||
"typescript": "^4.1.5",
|
||||
"wait-on": "^5.2.1"
|
||||
"wait-on": "^5.2.1",
|
||||
"webpack": "^4.42.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"svelte": "^3.32.3"
|
||||
"electronWebpack": {
|
||||
"commonSourceDirectory": "src/common",
|
||||
"staticSourceDirectory": "src/static",
|
||||
"main": {
|
||||
"sourceDirectory": "electron"
|
||||
},
|
||||
"renderer": {
|
||||
"sourceDirectory": "src",
|
||||
"webpackConfig": "./webpack.custom.config.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: sans-serif;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="Accord" />
|
||||
<link rel="stylesheet" type="text/css" href="./index.css" />
|
||||
<title>Accord</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module" src="./dist/index.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,38 +0,0 @@
|
|||
/** @type {import("snowpack").SnowpackUserConfig } */
|
||||
const builtinModules = require('builtin-modules')
|
||||
|
||||
module.exports = {
|
||||
mount: {
|
||||
/* ... */
|
||||
// 'build directory'
|
||||
public: '/',
|
||||
electron: '/',
|
||||
src: '/dist',
|
||||
},
|
||||
plugins: [
|
||||
/* ... */
|
||||
'@snowpack/plugin-svelte',
|
||||
'@snowpack/plugin-typescript',
|
||||
['snowpack-plugin-selective-import-to-require', {
|
||||
"modules": builtinModules,
|
||||
}],
|
||||
],
|
||||
routes: [
|
||||
/* Enable an SPA Fallback in development: */
|
||||
// {"match": "routes", "src": ".*", "dest": "/index.html"},
|
||||
],
|
||||
optimize: {
|
||||
/* Example: Bundle your final build: */
|
||||
// "bundle": true,
|
||||
},
|
||||
packageOptions: {
|
||||
/* ... */
|
||||
external: builtinModules
|
||||
},
|
||||
devOptions: {
|
||||
/* ... */
|
||||
},
|
||||
buildOptions: {
|
||||
/* ... */
|
||||
},
|
||||
};
|
|
@ -19,6 +19,16 @@
|
|||
</script>
|
||||
|
||||
<style>
|
||||
:global(html)
|
||||
width 100%
|
||||
height 100%
|
||||
|
||||
:global(body)
|
||||
margin 0
|
||||
font-family sans-serif
|
||||
width 100%
|
||||
height 100%
|
||||
|
||||
div
|
||||
width 100%
|
||||
height 100%
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import App from './App.svelte';
|
||||
import App from './App.svelte'
|
||||
|
||||
let app = new App({
|
||||
target: document.body,
|
||||
|
@ -6,12 +6,7 @@ let app = new App({
|
|||
|
||||
export default app
|
||||
|
||||
// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
|
||||
// Learn more: https://www.snowpack.dev/concepts/hot-module-replacement
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept()
|
||||
import.meta.hot.dispose(() => {
|
||||
app.$destroy()
|
||||
})
|
||||
// Webpack Hot Module Replacement (HMR)
|
||||
if (module.hot) {
|
||||
module.hot.accept()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
const autoPreprocess = require('svelte-preprocess')
|
||||
|
||||
module.exports = {
|
||||
preprocess: autoPreprocess({
|
||||
defaults: {
|
||||
script: 'typescript',
|
||||
style: 'stylus',
|
||||
},
|
||||
}),
|
||||
}
|
|
@ -9,10 +9,14 @@
|
|||
"module": "esnext",
|
||||
"paths": {
|
||||
},
|
||||
"noEmit": true,
|
||||
"resolveJsonModule": true,
|
||||
"useDefineForClassFields": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"importsNotUsedAsValues": "error",
|
||||
"target": "ES2019",
|
||||
"sourceMap": true,
|
||||
"types" : ["svelte", "node"],
|
||||
"allowJs": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
const path = require("path");
|
||||
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
|
||||
const svelte = path.resolve('node_modules', 'svelte');
|
||||
|
||||
const mode = process.env.NODE_ENV || 'development'
|
||||
const prod = mode === 'production'
|
||||
const dev = !prod
|
||||
|
||||
module.exports = {
|
||||
resolve: {
|
||||
alias: {
|
||||
svelte
|
||||
},
|
||||
extensions: ['.svelte', '.ts', '.js', '.mjs'],
|
||||
mainFields: ['svelte', 'browser', 'module', 'main']
|
||||
},
|
||||
devtool: "source-map",
|
||||
node: {
|
||||
__dirname: false,
|
||||
__filename: false
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.svelte$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'svelte-loader-hot',
|
||||
options: {
|
||||
emitCss: false,
|
||||
preprocess: require('svelte-preprocess')({
|
||||
defaults: {
|
||||
script: 'typescript',
|
||||
style: 'stylus',
|
||||
},
|
||||
}),
|
||||
dev,
|
||||
hotReload: true,
|
||||
hotOptions: {
|
||||
// whether to preserve local state (i.e. any `let` variable) or
|
||||
// only public props (i.e. `export let ...`)
|
||||
noPreserveState: false,
|
||||
// optimistic will try to recover from runtime errors happening
|
||||
// during component init. This goes funky when your components are
|
||||
// not pure enough.
|
||||
optimistic: true,
|
||||
|
||||
// See docs of svelte-loader-hot for all available options:
|
||||
//
|
||||
// https://github.com/rixo/svelte-loader-hot#usage
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ["css-loader"],
|
||||
options: {
|
||||
esModule: true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new FriendlyErrorsWebpackPlugin({ clearConsole: true })
|
||||
],
|
||||
devServer: {
|
||||
contentBase: 'dist',
|
||||
hot: true,
|
||||
overlay: true,
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue