Files
x-editable-bs5/webpack.config.js
Micha 1ae5282bc7 v25.0.6: Fix bootstrap-datepicker and select2 integration for Bootstrap 5
Major improvements and fixes:

## Bootstrap-datepicker Integration
- Fix DPGlobal undefined error in date input
- Remove conflicting bdatepicker alias that was causing noConflict errors
- Add graceful error handling for missing bootstrap-datepicker dependency
- Implement proper initialization sequence for DPGlobal API
- Position datepicker above input with improved UX styling

## Select2 Integration & Compatibility
- Fix select2 integration with Select2 v4.1.0-rc.0
- Resolve issue where select2:select event fired but value didn't update
- Add event handler to manually update select2 value on selection
- Fix webpack build inconsistency between demo and standalone builds
- Remove redundant npm dependencies from demo (bootstrap-datepicker, select2)
- Implement proper Select2 v4 API usage for value setting

## Build System Improvements
- Fix webpack configuration to properly handle CSS imports
- Remove CSS file copying for npm dependencies, use webpack imports instead
- Ensure consistent input type registration across all build targets
- Clean up build output and remove debugging code

## Demo & Testing
- Update demo to use webpack source build for consistency
- Add comprehensive error handling and user feedback
- Clean up all debugging console output
- Improve demo page descriptions and usability

## Technical Fixes
- Fix 'Unknown type: select2' error in demo build
- Resolve value change detection preventing save operations
- Implement savenochange option for better UX
- Remove deprecated jQuery UI conflicts and aliases
- Update to modern webpack and build practices
2025-07-29 13:36:06 +02:00

80 lines
2.5 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") },
]
})
]
},
// 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")
}
},
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
}
]
}
}
];