Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors on Boostrap 5.2.2 javascript minification #15

Open
it-xtech-dev opened this issue Oct 25, 2022 · 1 comment
Open

Errors on Boostrap 5.2.2 javascript minification #15

it-xtech-dev opened this issue Oct 25, 2022 · 1 comment

Comments

@it-xtech-dev
Copy link

it-xtech-dev commented Oct 25, 2022

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

  1. Download boostrap 5.2.2, https://github.com/twbs/bootstrap/releases/download/v5.2.2/bootstrap-5.2.2-dist.zip
  2. Try to bundle: js\bootstrap.bundle.js
  3. 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 #2 but specified version (2.9.3) seems not solve the problem.

@failwyn
Copy link
Owner

failwyn commented Nov 10, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants