Billboard.js: Billboard.js 1.11.0 doesn't support IE 11

Created on 29 Nov 2019  路  5Comments  路  Source: naver/billboard.js

Description


Billboard.js v1.11.0 doesn't work in IE.
I think that it's because It depends on d3-array 2.4.0 that doesn't support IE anymore. https://github.com/d3/d3-array/issues/87

https://github.com/naver/billboard.js/blob/fbb89464ff78a427c9b9f5449d628bd269784e0e/package.json#L110

practical question

Most helpful comment

@imbyungjun, from the 1.11.0 release, the d3 dependency is updated to be as separated used d3 modules only. (Ref. #1054)

From this change, when you import billboard.js, the dependent d3 modules will be concatenated & bundled in your build from the node_modules.

If you use webpack as bundler, generally node_modules is pointed to be excluded from the loader boundary, where this issue comes.

This issue will not have effect if you include as <script> tag. Only is happening when you import as ESM and is targeting for old IEs.

So, there're two possible solutions on this.

1) Make 'd3-*' modules to be transpiled

When your bundler(ex. webpack) configuration set is excluding node_modules, update to include d3- modules giving below configuration.

// webpack.config.js
module: {
    rules: [
        {
            test: /(\.js)$/,
            exclude: {
                test: /node_modules/,
                not: [/(d3\-.*)$/]
            },
            use: {
                loader: "babel-loader"
            },
        },

Pros

You can apply your own optimized configuration for dependent modules.

Cons

You might need to handle all of possible legacy related polyfills and transformation needed.

2) Use transpiled d3 packaged build

If you don't want to handle all possible configuration for legacy browsers, just use packaged build.

import {bb} from "billboard.js/dist/billboard.pkgd";

bb.generate(...);

In this case, you need to add on your bundler configuration to not concatenate d3 modules, because packaged build already contains them.

// webpack.config.
externals: /^(d3\-.*)$/i,

Pros

Get rid all the headache configuration for the legacy environment.

Cons

Might possibly make bigger the build size, because of polyfills.

All 5 comments

Hi @imbyungjun, I ran the build and seems working fine.
The d3-array used in Stanford Diagram plugin only and from the base library it was removed the use of it(#710).

ie11

Could you provide detailed reproducible case?

@imbyungjun, from the 1.11.0 release, the d3 dependency is updated to be as separated used d3 modules only. (Ref. #1054)

From this change, when you import billboard.js, the dependent d3 modules will be concatenated & bundled in your build from the node_modules.

If you use webpack as bundler, generally node_modules is pointed to be excluded from the loader boundary, where this issue comes.

This issue will not have effect if you include as <script> tag. Only is happening when you import as ESM and is targeting for old IEs.

So, there're two possible solutions on this.

1) Make 'd3-*' modules to be transpiled

When your bundler(ex. webpack) configuration set is excluding node_modules, update to include d3- modules giving below configuration.

// webpack.config.js
module: {
    rules: [
        {
            test: /(\.js)$/,
            exclude: {
                test: /node_modules/,
                not: [/(d3\-.*)$/]
            },
            use: {
                loader: "babel-loader"
            },
        },

Pros

You can apply your own optimized configuration for dependent modules.

Cons

You might need to handle all of possible legacy related polyfills and transformation needed.

2) Use transpiled d3 packaged build

If you don't want to handle all possible configuration for legacy browsers, just use packaged build.

import {bb} from "billboard.js/dist/billboard.pkgd";

bb.generate(...);

In this case, you need to add on your bundler configuration to not concatenate d3 modules, because packaged build already contains them.

// webpack.config.
externals: /^(d3\-.*)$/i,

Pros

Get rid all the headache configuration for the legacy environment.

Cons

Might possibly make bigger the build size, because of polyfills.

Appreciate for your detailed guide! It perfectly works for me.

I fixed it by transpiling d3-* modules.

To resolve d3-scale module's compatibility issue, "@babel/plugin-transform-for-of" plugin was needed

If you are using babel7 and /node_modues/ still not transplie to es5, consider this solution.

FYI @jm-chong, @imbyungjun
Downgraded d3-scale version to get rid the need of transpile the code.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mafar picture mafar  路  4Comments

doubletuna picture doubletuna  路  3Comments

matthiaskomarek picture matthiaskomarek  路  4Comments

planttheidea picture planttheidea  路  4Comments

stevenmusumeche picture stevenmusumeche  路  3Comments