Files
docx-js/webpack.config.ts

49 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-09-30 15:00:49 +01:00
const path = require("path");
const { ProvidePlugin } = require("webpack");
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",
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"),
},
plugins: [new TsconfigPathsPlugin()],
2017-12-22 16:49:25 +00:00
},
module: {
rules: [
{
test: /\.ts$/,
2021-03-31 21:27:40 +01:00
loader: "ts-loader",
options: {
configFile: "tsconfig.lib.json",
2021-03-31 21:27:40 +01:00
},
2018-08-15 01:38:00 +01:00
},
],
2017-12-22 16:49:25 +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;