-
Notifications
You must be signed in to change notification settings - Fork 39
/
webpack.config.ts
42 lines (39 loc) · 1.5 KB
/
webpack.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import * as path from "path";
import * as webpack from "webpack";
// This is a very lean example of a webpack config file to use for using the browser
// implementation of the package. It is using the compiled files of the ingest library and will load its index.js file.
// USAGE: npm run webpack
let config = {
entry: {
index: "./packages/azure-kusto-ingest/dist-esm/src/index",
},
target: "web",
output: {
filename: "[name].js", // The index.html script file
path: path.resolve(__dirname, "dist"),
},
resolve: {
aliasFields: ["browser"],
fallback: {
stream: require.resolve("stream-browserify"),
// ESM has issue importing process/browser without this resolve
"process/browser": require.resolve("process/browser"),
}, // Over fallbacks are in the package.json file
extensions: [".ts", ".js"],
},
devtool: "inline-source-map",
devServer: {
// We use static files so we can use the dist-esm js files with files mapping.
// Maybe we can do better so we can use ts-loader module and load typescript files
static: ["./packages/azure-kusto-ingest/dist-esm"],
port: 3000, // This port should be open in the SPA aad app
},
plugins: [
// Work around for Buffer is undefined:
// https://github.com/webpack/changelog-v5/issues/10
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
],
};
export default config;