Skip to content

Commit 8bb9c87

Browse files
authored
Merge pull request #67 from mendix/isolate-webpack
[WC-1720] fix: isolate webpack runtime to prevent conflicts with other bundles
2 parents b2eb4b3 + e322e00 commit 8bb9c87

5 files changed

Lines changed: 13 additions & 10 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "LabelSelect",
3-
"version": "4.5.9",
3+
"version": "4.6.0",
44
"description": "With this widget you can easily create/assign/remove objects (for example labels) to/from an object.",
55
"license": "Apache-2",
66
"author": "",

src/LabelSelect/widget/LabelSelect.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ define([
1313
], function(declare, _WidgetBase, _TemplatedMixin, dom, domClass, domStyle, domConstruct, dojoArray, lang, widgetTemplate, _jQuery) {
1414
"use strict";
1515

16-
window.jQuery = window.$ = _jQuery;
17-
1816
require(["./lib/jquery-migrate", "jquery-ui", "jquery-ui/ui/widgets/autocomplete", "jquery-ui/ui/widgets/menu", "jquery-ui/ui/widgets/selectable", "./lib/tag-it",]);
1917

2018
return declare("LabelSelect.widget.LabelSelect", [_WidgetBase, _TemplatedMixin], {
@@ -138,19 +136,19 @@ define([
138136
value = tagObj.get(this._tagAttribute);
139137
color = (this._colorAttribute) ? dom.escapeString(tagObj.get(this._colorAttribute)) : null;
140138

141-
$("#" + this.id + "_ListBox").tagit("createTag", value, additionalClass, duringInitialization, color);
139+
_jQuery("#" + this.id + "_ListBox").tagit("createTag", value, additionalClass, duringInitialization, color);
142140
}, this);
143141

144142
this._executeCallback(callback, "_renderCurrentTags");
145143
},
146144

147145
_startTagger: function(options) {
148146
if (options) {
149-
$("#" + this.id + "_ListBox").tagit(options);
147+
_jQuery("#" + this.id + "_ListBox").tagit(options);
150148
} else {
151149
//fallback
152150
console.warn("No options found, running defaults");
153-
$("#" + this.id + "_ListBox").tagit();
151+
_jQuery("#" + this.id + "_ListBox").tagit();
154152
}
155153
},
156154

src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="LabelSelect" version="4.5.9" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="LabelSelect" version="4.6.0" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="LabelSelect/LabelSelect.xml"/>
66
</widgetFiles>

webpack.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ module.exports = {
1717
filename: `${widgetName}/widget/[name].js`,
1818
chunkFilename: `${widgetName}/widget/${widgetName}[id].js`,
1919
libraryTarget: "amd",
20-
publicPath: "/widgets/"
20+
publicPath: "/widgets/",
21+
jsonpFunction: "label_selector_jsonp"
2122
},
2223
devtool: false,
2324
mode: "production",
@@ -26,6 +27,10 @@ module.exports = {
2627
new webpack.LoaderOptionsPlugin({ debug: true }),
2728
new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: "dist/tmp" }),
2829
new CopyWebpackPlugin([ {context: "src", from: "**/*.{xml,css,html,png,gif}", debug: true} ], { copyUnmodified: true }),
29-
new ZipPlugin({ path: `../../${widgetVersion}`, filename: widgetName, extension: "mpk" })
30+
new ZipPlugin({ path: `../../${widgetVersion}`, filename: widgetName, extension: "mpk" }),
31+
new webpack.ProvidePlugin({
32+
$: "jquery",
33+
jQuery: "jquery"
34+
})
3035
]
3136
};

0 commit comments

Comments
 (0)