Skip to content

minifying chart.js #6659

Closed
Closed
@tschmit

Description

@tschmit

Expected Behavior

minify without error

Current Behavior

when minifying chart.js the minifyer argues that:

2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(362,27,362,27): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: b
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(362,20,362,20): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: g
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(362,13,362,13): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: r
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(363,27,363,27): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: b
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(363,20,363,20): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: g
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(363,13,363,13): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: r
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(364,28,364,28): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: b
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(364,21,364,21): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: g
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(364,13,364,13): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: r
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(365,28,365,28): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: b
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(365,21,365,21): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: g
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(365,13,365,13): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: r
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(366,28,366,28): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: b
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(366,20,366,20): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: g
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(366,13,366,13): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: r
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(367,28,367,28): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: b
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(367,20,367,20): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: g
2>D:\dev\fromGit\myProject\myProject\wwwroot\lib\chartjs\dist\Chart.min.js(367,13,367,13): Bundler & Minifier error 0: Strict-mode does not allow assignment to undefined variables: r

Possible Solution

define the variables:

var r, g, b;
switch (i) {
    default:
    case 6:
    case 0: r = v; g = n; b = wh; break;
    case 1: r = n; g = v; b = wh; break;
    case 2: r = wh; g = v; b = n; break;
    case 3: r = wh; g = n; b = v; break;
    case 4: r = n; g = wh; b = v; break;
    case 5: r = v; g = wh; b = n; break;
  }

Steps to Reproduce (for bugs)

minify chart.js with "bundler and minifyer" under visual studio 2019 Community edition.

Environment

  • Chart.js version: 2.9.1
  • Browser name and version: NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions