Files
x-editable-bs5/webpack.config.js
Micha 9d84a1f21d Restore select2 input functionality after Bootstrap 5 cleanup
- Restored select2 input type from earlier commit d4adf5e^
- Added select2 import to bootstrap5-editable.js bundle
- Updated demo with select2 example (requires select2 library)
- Enhanced README.md with comprehensive select2 documentation
- Includes support for static sources, AJAX sources, and advanced configuration
- Select2 library must be included separately (not bundled)
2025-07-28 12:48:43 +02:00

73 lines
2.4 KiB
JavaScript

const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");
module.exports = [
// Main bundle (jQuery, Bootstrap, App)
{
entry: {
jquery: "jquery",
app: "./demo/demo.js",
},
output: {
path: path.resolve(__dirname, "dist"), // Place them directly in dist/
filename: "[name].js", // app.js, jquery.js, bootstrap.js
},
resolve: {
alias: {
jquery: path.resolve(__dirname, "node_modules/jquery"),
bootstrap: path.resolve(__dirname, "node_modules/bootstrap"),
"bootstrap5-editable": path.resolve(__dirname, "dist/bootstrap5-editable")
}
},
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
type: "asset/resource",
generator: {
filename: "fonts/[name][ext]"
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
bootstrap: "bootstrap",
"window.bootstrap": "bootstrap"
}),
new CopyWebpackPlugin({
patterns: [
{ from: "src/editable-form/editable-form.css", to: path.resolve(__dirname, "dist/bootstrap5-editable/css") },
{ from: "node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css", to: path.resolve(__dirname, "dist/bootstrap5-editable/css") }
]
})
]
},
// X-Editable Plugin (Bootstrap 5)
{
entry: "./src/bootstrap5-editable.js",
output: {
path: path.resolve(__dirname, "dist/bootstrap5-editable/js"), // X-Editable stays here
filename: "bootstrap-editable.js",
library: {
name: "EditableForm",
type: "umd"
}
},
resolve: {
alias: {
jquery: path.resolve(__dirname, "node_modules/jquery"),
bootstrap: path.resolve(__dirname, "node_modules/bootstrap")
}
}
}
];