
- Convert all IIFE modules to ES6 modules with attach functions - Split webpack configs: lib build vs demo build - Add UMD wrapper for auto-initialization with jQuery - Update package.json with sequential build scripts - Clean up legacy dist files and reorganize demo structure Status: jQuery timing issues remain - attach functions not accessible Next: Debug UMD factory execution and jQuery parameter passing
68 lines
2.0 KiB
JavaScript
68 lines
2.0 KiB
JavaScript
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")
|
|
}
|
|
]
|
|
})
|
|
]
|
|
}; |