vis-network icon indicating copy to clipboard operation
vis-network copied to clipboard

Angular: CommonJS or AMD dependencies can cause optimization bailouts

Open shaozi opened this issue 4 years ago • 2 comments

When using Angular, importing from vis-network

import {
  Network,
  Node,
  Data,
  Options,
} from 'vis-network'

and it caused this warning:

Warning: ... depends on 'vis-network'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

shaozi avatar Apr 30 '21 20:04 shaozi

Even when it's imported from esnext

import { Network } from 'vis-network/esnext'

still we get the following

node_modules\vis-network\esnext\esm\vis-network.js depends on 'component-emitter'. 
CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

technbuzz avatar Nov 14 '22 08:11 technbuzz

I can confirm that it is still an issue with version 9.1.9 of vis-network. It makes the application bundle larger by almost one megabyte for Angular app with a simple demo of vis network usage, which is a lot.

kponichtera avatar Feb 24 '24 17:02 kponichtera