Cargo features from config
maccesch opened this issue · 5 comments
During development we have quite a few handy but slow debugging features enabled. I'd like to activate them from the config.
It would be great to have a features
key in the config that controls which features for a crate are active.
In addition to future proof this it probably makes sense to implement an additional general purpose key like extraArguments
or sth like this that allows to add arbitrary arguments to add to the call to cargo build
.
To build production environment code, please use rsw-node. Its not recommended to use --release in dev mode. Thanks for the suggestion, we would consider adding support for the following parameters within later iterations:
export type RswCrateOptions = {
// support `--out-name` and `scope`
name: string;
// `--out-dir`
outDir?: string;
// defalut: 'web'
target?: 'bundler' | 'web' | 'nodejs' | 'no-modules';
// no default value
mode?: 'no-install' | 'normal';
// extra options
extraOpts?: string[];
// https://github.com/lencx/vite-plugin-rsw/issues/24
// when crate is built in a watched directory,
// stop watching files, directories, or glob patterns, takes an array of strings.
unwatch?: string[];
}
@maccesch install the v1.10.0
version to try the plugin options.
unfortunately it doesn't work.
I added
extraOpts: [ 'features debug' ]
but I get this error message:
error: Found argument 'debug' which wasn't expected, or isn't valid in this context
if I use
extraOpts: [ '--features debug' ]
I get another error. Both don't work.
The CLI command I want to produce in the end is:
cargo b --features debug
extraOpts
are not used in this way, please refer to the documentation wasm-pack build
.
The documentation says that you can pass arguments to the cargo build
command after --
. So it would look like wasm-pack build … -- --features debug
. How can I do that?