2021-09-30 15:00:49 +01:00
|
|
|
const path = require("path");
|
|
|
|
const { ProvidePlugin } = require("webpack");
|
2022-06-26 23:26:42 +01:00
|
|
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
2021-03-31 21:27:40 +01:00
|
|
|
|
2021-09-30 15:00:49 +01:00
|
|
|
const configuration = {
|
2021-03-31 21:27:40 +01:00
|
|
|
mode: "production",
|
2017-12-22 16:49:25 +00:00
|
|
|
|
2018-08-15 01:38:00 +01:00
|
|
|
entry: "./src/index.ts",
|
2017-12-22 16:49:25 +00:00
|
|
|
|
|
|
|
output: {
|
2018-08-15 01:38:00 +01:00
|
|
|
path: path.resolve("build"),
|
|
|
|
filename: "index.js",
|
|
|
|
libraryTarget: "umd",
|
2019-10-12 22:16:36 +01:00
|
|
|
library: "docx",
|
2021-03-31 21:27:40 +01:00
|
|
|
globalObject: "this",
|
2017-12-22 16:49:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
resolve: {
|
2021-03-31 21:27:40 +01:00
|
|
|
extensions: [".ts", ".js"],
|
2018-08-15 01:38:00 +01:00
|
|
|
modules: [path.resolve("./src"), "node_modules"],
|
2021-03-31 21:27:40 +01:00
|
|
|
fallback: {
|
|
|
|
buffer: require.resolve("buffer"),
|
|
|
|
stream: require.resolve("stream-browserify"),
|
|
|
|
},
|
2022-06-26 23:26:42 +01:00
|
|
|
plugins: [new TsconfigPathsPlugin()],
|
2022-08-22 13:24:12 -07:00
|
|
|
alias: {
|
|
|
|
jszip: require.resolve('jszip/lib/index.js'),
|
|
|
|
},
|
2017-12-22 16:49:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2017-12-29 01:11:59 +00:00
|
|
|
test: /\.ts$/,
|
2021-03-31 21:27:40 +01:00
|
|
|
loader: "ts-loader",
|
|
|
|
options: {
|
2022-06-26 23:26:42 +01:00
|
|
|
configFile: "tsconfig.lib.json",
|
2021-03-31 21:27:40 +01:00
|
|
|
},
|
2018-08-15 01:38:00 +01:00
|
|
|
},
|
2017-12-29 01:11:59 +00:00
|
|
|
],
|
2017-12-22 16:49:25 +00:00
|
|
|
},
|
2017-12-29 01:11:59 +00:00
|
|
|
|
2021-03-31 21:27:40 +01:00
|
|
|
plugins: [
|
|
|
|
// fix "process is not defined" error
|
|
|
|
new ProvidePlugin({
|
|
|
|
process: "process/browser",
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = configuration;
|