Dfx npm run build command name

Is it possible to specify which npm build command dfx deploy or dfx build should call?

I would like that dfx build calls a particular npm script defined in my package.json.

For example being able to define and call such a build script in my package.json and not npm run build.

"scripts": {
    "build:ic": "cd somewhere && webpack --variable1 --variable2"

Why not do the opposite? Specify your npm scripts the way you want to and add “dfx deploy” or “dfx build” to an npm script

That’s been hard-coded since I joined. I’ve set "build": "" before sometimes when I wanted more control over when I run things.

It wasn’t enough of an annoyance to me that I felt like setting up a new configuration for it, but it would certainly be doable. I’m not sure exactly what I’d name the setting

Is there a way to instruct dfx deploy / build to not automatically call npm run build?

If yes, sure that would do the trick. If no, ultimately it would still call the build script I think.

Oh I see, thanks for the confirmation.

It isn’t the biggest annoyance but, in my use case, I had to add a build at the root of my mono-repo, thought it would be cleaner to at least give it an explicit name.

Yes maybe an option would be nice, don’t know neither how to call it or, an alternative would be to have an option to not build the frontend app. In that way it would be possible to add a script in package.json that calls dfx with or without building.

Also made me think, out of curiosity, does dfx support other package manager like yarn or pnpm?

Is there a way by now to specify a build command that dfx build calls? E.g. npm run build:production instead of npm run build

I think I read something recently mentionning @NathanosDev about this. Do you know the status of providing a custom build command to dfx Nathan?

It should appear in the next dfx release

4 Likes