Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--target flag appears to not be working #4

Closed
andr-ec opened this issue Mar 17, 2022 · 3 comments
Closed

--target flag appears to not be working #4

andr-ec opened this issue Mar 17, 2022 · 3 comments

Comments

@andr-ec
Copy link

andr-ec commented Mar 17, 2022

running npm run vite-tauri build --target x86_64-apple-darwin always yields an error

npm run vite-tauri build --target x86_64-apple-darwin

> project@0.0.0 vite-tauri /path/to/project
> vite-tauri "build" "x86_64-apple-darwin"

[vite-plugin-tauri]  Building Vite project...
vite v2.8.4 building for production...
✓ 98 modules transformed.

dist/index.html                  0.48 KiB
dist/assets/index.04504daf.js    8.07 KiB / gzip: 3.42 KiB
dist/assets/index.d260c74e.css   320.40 KiB / gzip: 41.45 KiB
dist/assets/vendor.ce5b3565.js   340.00 KiB / gzip: 88.89 KiB
[vite-plugin-tauri]  Vite build finished.
[vite-plugin-tauri]  Building Tauri app...
error: Found argument 'x86_64-apple-darwin' which wasn't expected, or isn't valid in this context

USAGE:
    cargo build --features <FEATURES>...

For more information try --help
[vite-plugin-tauri]  Error: failed to build app: Result of `cargo build` operation was unsuccessful: exit status: 1

The corresponding command using the tauri cli works just fine:

tauri build --target x86_64-apple-darwin

Do flags need to be escaped somehow?

@andr-ec
Copy link
Author

andr-ec commented Mar 17, 2022

Easy workaround:
add to scripts section of package.json

    "vite-tauri:build:x86": "vite-tauri build --target x86_64-apple-darwin",
    "vite-tauri:build:universal": "vite-tauri build --target universal-apple-darwin",

@andr-ec andr-ec closed this as completed Mar 17, 2022
@amrbashir
Copy link
Owner

amrbashir commented Mar 17, 2022

It is not an issue with this plugin. You are using npm, and in some npm versions, you need to add extra "--" before passing any options to the cli.

So your command needs to be like this

npm run vite-tauri build -- --target x86_64-apple-darwin

@andr-ec
Copy link
Author

andr-ec commented Mar 17, 2022

I was about to comment that I found the same thing, Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants