const webpack = require("webpack"); const CopyWebpackPlugin = require("copy-webpack-plugin"); const path = require("path"); // X-Editable Plugin (Bootstrap 5) - Library build only module.exports = { entry: "./src/umd-wrapper.js", output: { path: path.resolve(__dirname, "dist/bootstrap5-editable/js"), filename: "bootstrap-editable.js", library: { name: "EditableForm", type: "umd", export: 'default' }, globalObject: "this", clean: true, // Clean the output directory before emit // Custom UMD template that auto-calls the exported function with jQuery auxiliaryComment: { root: "X-Editable Bootstrap 5 - Auto-initializing UMD Bundle", commonjs: "X-Editable Bootstrap 5 - CommonJS", commonjs2: "X-Editable Bootstrap 5 - CommonJS2", amd: "X-Editable Bootstrap 5 - AMD" } }, externals: { jquery: { commonjs: "jquery", commonjs2: "jquery", amd: "jquery", root: "jQuery" }, bootstrap: { commonjs: "bootstrap", commonjs2: "bootstrap", amd: "bootstrap", root: "bootstrap" } }, resolve: { alias: { jquery: path.resolve(__dirname, "node_modules/jquery"), bootstrap: path.resolve(__dirname, "node_modules/bootstrap") } }, module: { rules: [ { test: /\.css$/, use: ["style-loader", "css-loader"] } ] }, plugins: [ new CopyWebpackPlugin({ patterns: [ { from: "src/editable-form/editable-form.css", to: path.resolve(__dirname, "dist/bootstrap5-editable/css/bootstrap-editable.css") }, { from: "src/img", to: path.resolve(__dirname, "dist/bootstrap5-editable/img") } ] }) ] };