BundlerMinifier
BundlerMinifier copied to clipboard
Errors on Boostrap 5.2.2 javascript minification
Installed product versions
- Visual Studio: 2022
- This extension: 2.9.3
Description
While bundling boostrap 5.2.2 js bundle an error occurs.
Steps to recreate
- Download boostrap 5.2.2, https://github.com/twbs/bootstrap/releases/download/v5.2.2/bootstrap-5.2.2-dist.zip
- Try to bundle: js\bootstrap.bundle.js
- Errors are throw: Strict-mode does not allow duplicate property names: ...(isElement$1(element) ? Manipulator.getDataAttributes(element) : {}) Strict-mode does not allow duplicate property names: ...(typeof config === 'object' ? config : {})
Current behavior
An error occurs on these lines:
_mergeConfigObj(config, element) {
const jsonConfig = isElement$1(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
return { ...this.constructor.Default,
...(typeof jsonConfig === 'object' ? jsonConfig : {}),
...(isElement$1(element) ? Manipulator.getDataAttributes(element) : {}),
...(typeof config === 'object' ? config : {})
};
}
A error will not occur when changing code like below. This points that there is some improper Minifier / nuglify behavior.
_mergeConfigObj(config, element) {
const jsonConfig = isElement$1(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
const prop1 = (isElement$1(element) ? Manipulator.getDataAttributes(element) : {})
const prop2 = (typeof config === 'object' ? config : {})
return { ...this.constructor.Default,
...(typeof jsonConfig === 'object' ? jsonConfig : {}),
...prop1,
...prop2
};
}
Expected behavior
Should bundle without any problemy
Additional info
Issue seems to be similar to https://github.com/failwyn/BundlerMinifier/issues/2 but specified version (2.9.3) seems not solve the problem.
There are a few issues in the NUglify repo about the spread operator, hopefully updating the version will address this issue; will get it out as soon as I can.