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

Object reference not set to an instance of an object error when minifying d3.v7.min.js #594

Open
plqplq opened this issue Mar 6, 2023 · 1 comment
Labels

Comments

@plqplq
Copy link

plqplq commented Mar 6, 2023

Describe the bug
When you try to re-minify the latest d3 v7 in already-minified state, a compilation error occurs with object variable not set.

To Reproduce
In Visual Studio 2022, create a project that includes d3.v7.min.js copied locally as a javascript file, and try to re-minify it in bundleconfig:

  {
    "outputFileName": "js/a.js",
    "includeInProject": true,
    "inputFiles": [
      "js/jq3.min.js",
      **"js/d3.min.js",**
      "js/select2.full.min.js",
      "js/jcode.min.js",
      "js/atemp.min.js",
      "js/googlemaps.js"
    ],
    "minify": {
      "enabled": **true**,
      "renameLocals": false,
      "evalTreatment": "makeAllSafe"
    }

  },

The above code caused the error, and setting minify:enabled:false fixes it.

    "minify": {
      "enabled": **false**,

Although this is easy to workaround, it's an opportunity to improve the error message that is thrown and also an opportunity to fix the problem that some kind of es6 construct is throwing this message.

Expected behavior
Compilation should succeed.

Screenshots

Build started...
------ Build started: Project: web7, Configuration: Debug Any CPU ------
  
  Bundler: Begin processing bundleconfig.json
C:\xam7\web7\js\a.js : Bundler & Minifier error 0: Object reference not set to an instance of an object.
  Bundler: Done processing bundleconfig.json
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
========== Elapsed 00:00.248 ==========
@plqplq plqplq added the bug label Mar 6, 2023
@plqplq plqplq changed the title Object Variable not set error when minifying d3.v7.min.js Object Object reference not set to an instance of an object error when minifying d3.v7.min.js Mar 6, 2023
@plqplq plqplq changed the title Object Object reference not set to an instance of an object error when minifying d3.v7.min.js Object reference not set to an instance of an object error when minifying d3.v7.min.js Mar 6, 2023
@myesn
Copy link

myesn commented Oct 10, 2023

image

You should double-check the inputFile that reports the error, if there is a syntax error, the vs extension will throw an error Object reference not set to an instance of an object, the secret is to fix all the little green waves that appear.

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

No branches or pull requests

2 participants