Files
docx-js/webpack.config.ts

47 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-01-16 13:34:32 +00:00
import * as path from "path";
2021-03-31 21:27:40 +01:00
import { Configuration, ProvidePlugin } from "webpack";
const configuration: Configuration = {
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"),
},
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.json",
},
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;