Add bundler

This commit is contained in:
Tiana Lemesle 2021-08-24 15:31:41 +02:00
parent 64dd5feca5
commit 7037122cc2
4 changed files with 4887 additions and 38 deletions

View File

@ -2,13 +2,14 @@
"name": "tauri-webview-template",
"description": "Tauri Webview Template",
"version": "0.1.0",
"main": "index.js",
"main": "src/index.js",
"repository": "https://git.kaki87.net/KaKi87/tauri-webview-template",
"author": "KaKi87 <KaKi87@pm.me>",
"license": "MIT",
"devDependencies": {
"@tauri-apps/cli": "^1.0.0-beta.10",
"outdent": "^0.8.0"
"outdent": "^0.8.0",
"parcel-bundler": "^1.12.5"
},
"scripts": {
"init-app": "node ./init.js",

5
run.js
View File

@ -2,6 +2,7 @@ const
{ mkdir, writeFile, readFile } = require('fs'),
{ join: joinPath } = require('path'),
outdent = require('outdent'),
Parcel = require('parcel-bundler'),
{ description } = require('./package.json'),
{ url } = require('./config.json'),
mainRustFilePath = joinPath(__dirname, './src-tauri/src/main.rs');
@ -23,9 +24,11 @@ const
mainRustFilePath,
mainRustFileContent.replace(
/^(\s+tauri::Builder::default\(\)).*$/m,
'$1.on_page_load(|window, _| { let _ = window.eval(include_str!("../../index.js")); })'
'$1.on_page_load(|window, _| { let _ = window.eval(include_str!("../../dist/index.js")); })'
),
'utf8',
resolve
));
await new Parcel(joinPath(__dirname, './src/index.js')).bundle();
process.exit();
})();

4915
yarn.lock

File diff suppressed because it is too large Load Diff