Skip to content

[bug] meta tag redirects break production build #3887

Description

@Nickersoft

Describe the bug

Hey all,

I'm currently experimenting with bundling a SvelteKit application with Tauri using the @sveltejs/adapter-static adapter. My adapter builds all of my resources to a build directory in my project folder, which I can then view with yarn preview. However, when I run tauri build to build a production version of my app, opening it results in a white screen.

Upon checking the macOS app contents, there is only an info.plist file, a resources/icon.icns file, and my application binary. The debug version of the production app (using --debug) won't let me use "Inspect Element" either. I click it and nothing opens.

Despite all this, running tauri dev spins up my dev server and opens a preview application that loads just fine. Not sure what could be going wrong in the bundling step. Tauri can obviously see my build directory, because when I change the path the build step errors.

Here's my current config:

{
	"package": {
		"productName": "MyApp",
		"version": "0.1.0"
	},
	"build": {
		"distDir": "../build",
		"devPath": "http://localhost:3000",
		"beforeDevCommand": "yarn dev",
		"beforeBuildCommand": "yarn build"
	},
	"tauri": {
		"bundle": {
			"active": true,
			"targets": "all",
			"identifier": "com.tauri.dev",
			"icon": [
				"icons/32x32.png",
				"icons/128x128.png",
				"icons/128x128@2x.png",
				"icons/icon.icns",
				"icons/icon.ico"
			],
			"resources": [],
			"externalBin": [],
			"copyright": "",
			"category": "DeveloperTool",
			"shortDescription": "",
			"longDescription": "",
			"deb": {
				"depends": [],
				"useBootstrapper": false
			},
			"macOS": {
				"frameworks": [],
				"useBootstrapper": false,
				"exceptionDomain": "",
				"signingIdentity": null,
				"providerShortName": null,
				"entitlements": null
			},
			"windows": {
				"certificateThumbprint": null,
				"digestAlgorithm": "sha256",
				"timestampUrl": ""
			}
		},
		"updater": {
			"active": false
		},
		"allowlist": {
			"all": false
		},
		"windows": [
			{
				"title": "MyApp",
				"width": 1024,
				"height": 600,
				"minWidth": 1024,
				"minHeight": 600,
				"resizable": true,
				"fullscreen": false
			}
		],
		"security": {
			"csp": null
		}
	}
}

I minimally modified the config from what was generated when I first made my project... am I doing something wrong, or is this a bug?

Reproduction

I don't have a reproduction repo to share, but from what I assume, creating an empty SvelteKit project, then adding Tauri to, then running a production build should reproduce the issue.

Expected behavior

I would expect the production build to function the same as the development preview.

Platform and versions

Environment
  › OS: Mac OS 12.3.1 X64
  › Node.js: 16.9.1
  › npm: 7.21.1
  › pnpm: Not installed!
  › yarn: 3.0.2
  › rustup: 1.24.3
  › rustc: 1.59.0
  › cargo: 1.59.0
  › Rust toolchain: stable-x86_64-apple-darwin 

Packages
  › @tauri-apps/cli [NPM]: 1.0.0-rc.7
  › @tauri-apps/api [NPM]: Not installed!
  › tauri [RUST]: 1.0.0-rc.6,
  › tauri-build [RUST]: 1.0.0-rc.5,
  › tao [RUST]: 0.7.0,
  › wry [RUST]: 0.14.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../build
  › devPath: http://127.0.0.1:3000/
  › framework: Svelte

App directory structure
  ├─ .yarn
  ├─ node_modules
  ├─ .storybook
  ├─ static
  ├─ src-tauri
  ├─ .svelte-kit
  ├─ build
  ├─ .git
  ├─ .vscode
  └─ src

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions