It should obey that flag. I know that i can do "npm i --no-optional", but that defeats the whole purpose of having lock files.