I want to bundle my electron app with webpack to reduce the package size and to improve performance. However, got appears to not work with webpack.
When I get the body of a request, I get tons of Unicode characters which do not mean anything:
��?��f�"y�,yv�r�Q��>�2�
^ِ>�a�xl��Z)�����֘{��Бi
V���\V����2��?��u�2�
6]x���"8��.�/���������(��$�ʱ5���86
O��b���Oe��k^�t6��B
���M
����N�F�}p�ۍaxt�ޭT�J(�Z'ODF
(This is only part of it)
There also seems to be another error where the payload of a POST request is sent as (See edit at end)[object Object].
I should get the response from the server
// index.ts
const res = got("https://www.google.com");
res.then(data => {
console.log(data.body);
});
This code is situated in the entry point of my app.
Here is my webpack configuration:
const path = require("path");
module.exports = {
mode: "development",
devtool: "inline-source-map",
entry: "./src/renderer/index.ts",
output: {
filename: "./dist/renderer.bundle.js",
libraryTarget: "window"
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{
test: /\.tsx?$/,
include: path.resolve(__dirname, 'src'),
loader: "ts-loader"
}
]
},
target: "electron-renderer"
};
EDIT:
[object Object] is actually not a problem with got but with a library I was using. Sorry for the confusion.Could you please include a repository example? I'm not familiar with webpack.
Could you please include a repository example? I'm not familiar with webpack.
I have not commited the changes yet but it should be here: lukechu10/Minecraft-Box-Launcher on the webpack-bundling branch
I was randomly checking this and found @lukechu10 probably fixed this on its end.