tauri/cli/tauri.js/helpers/tauri-config.js
Lucas Fernandes Nogueira 1951fc88c9 feat(tauri) lazy loading for the no-server mode (#161)
* feat(tauri) WIP on iframe wrapper

* fix(tauri) iframe communication working

* refactor(tauri) iframe injection on all modes

* feat(event): update tauri.js injection

* fix(tauri) rework on iframe/devServer

* feat(tauri.js) use load event to notify tauri ready

* fix(cargo.lock): remove erroneous lockfile

* WIP

* remove iframe

* feat(tauri) inline assets, inject tauri.js

* fix(example) tauri init

* fix(api) load bundled asset

* chore(api) remove println

* chore(template) remove deprecated event listener

* chore(example) gitignore tauri.js

* chore(package.json) update email

* fix(tauri) embedded-server's server_url definition

* chore(api) use salt on event listener again

* chore(webpack) add eslint

* remove forward slash

* perf(tauri) do not bundle inlined assets

* chore(tauri) macros and platform only when using the updater feature

* fix(tauri) proper feature check for the loadAsset API

* chore(tauri) add "forked from" reference

* chore(example) use @tauri-apps/tauri-webpack

* fix(tauri) dev-server mode fixes

* chore(example) use tauri-webpack 0.1.3

* feat(webpack) rewrite lazy loading only on the no-server mode

* fix(no-server) lazy load images

* chore(tauri) use forked includedir_codegen

* fix deps

* fix(tauri) use the right version for includedir deps

* chore(tauri) println rerun-if-changed on dev
2019-12-17 22:39:34 +01:00

50 lines
1.2 KiB
JavaScript

const appPaths = require('./app-paths')
const merge = require('webpack-merge')
const error = require('../helpers/logger')('ERROR:', 'red')
const { existsSync } = require('fs-extra')
module.exports = cfg => {
const pkgPath = appPaths.resolve.app('package.json')
const tauriConfPath = appPaths.resolve.app('tauri.conf.js')
if (!existsSync(pkgPath)) {
error('Could not find a package.json in your app\'s directory.')
process.exit(1)
}
if (!existsSync(tauriConfPath)) {
error('Could not find a tauri config (tauri.conf.js) in your app\'s directory.')
process.exit(1)
}
const tauriConf = require(tauriConfPath)(cfg.ctx)
const pkg = require(pkgPath)
const config = merge({
build: {},
ctx: {},
tauri: {
embeddedServer: {
active: true
},
bundle: {
active: true
},
whitelist: {
all: false
},
window: {
title: pkg.productName
},
security: {
csp: 'default-src data: filesystem: ws: http: https: \'unsafe-eval\' \'unsafe-inline\''
},
edge: {
active: true
}
}
}, tauriConf, cfg)
process.env.TAURI_DIST_DIR = appPaths.resolve.app(config.build.distDir)
process.env.TAURI_DIR = appPaths.tauriDir
return config
}