I solved it by adding plugins: ["@babel/plugin-transform-modules-commonjs"] to babel.config.js