I can create package of react app for SharePoint online by using "gulp serve" and "gulp package-solution" commands. However, I want to create package by using Webpack. How can I achieve this?
You can't create an SPFx package using webpack directly, however you have options to modify webpack configuration which is used by SPFx build pipeline internally.
Good reading here - Extending Webpack in the SharePoint Framework toolchain.
So theoretically you are able to modify some settings inside a webpack pipeline.
However, consider a few gotchas:
SPFx still uses webpack 3, thus you should use tree shaking features of webpack 3 (which are probably don't work as good as in 4.x version)
I'm not sure if in general, it's a good idea to change production-related settings for SPFx. From my perspective, it might lead to unexpected errors. Unfortunately, Microsoft doesn't provide clear information on this topic.