Electron Cannot find module on production build


I’m new in electron. I have an electron project that uses webpack, typeorm, and react.

This code below will works on development mode.

<div id="root"></div>
        const typeorm = require('typeorm')
        window.typeorm = typeorm

But after I build my electron app into an executable app (.exe for example) it throws an error on the console developer tools.

Uncaught Error: Cannot find module 'typeorm'

enter image description here

Is there any ways to expose typeorm module?