8000 Treeshaking does not work when excluding components · Issue #718 · fingerprintjs/fingerprintjs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Treeshaking does not work when excluding components #718
Open
@BafS

Description

@BafS

The documentation explains how to remove components (https://github.com/fingerprintjs/fingerprintjs/blob/master/docs/extending.md#extending-fingerprintjs) but unfortunately it doesn't seems to work well with treeshaking, the components stay in the compiled source.

It's possible to get the "sources" and whitelist components but the blobs are still not treeshaked. I tried with webpack 5.64 and rollup 2.42.

Example of what I had in mind:

import('@fingerprintjs/fingerprintjs').then(fp => {
  const sources = {
    audio: f.sources.audio, // I would expect to only have the audio component in the compiled source
  };
  const pp = fp.loadSources(fp.sources, {debug: true}, [])();

  pp.then(result => {
    console.log(result);
  });
}),

Another solution would be to be able to import every component individually (like import { audio } from '...'), threeshaking should work then.

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0