InteractiveAdvertisingBureau / iabtcf-es

Official compliant tool suite for implementing the Transparency and Consent Framework (TCF) v2.0. The essential toolkit for CMPs.
Apache License 2.0
133 stars 96 forks source link

Circular dependencies with TypeScript #348

Open jwrosewell opened 2 years ago

jwrosewell commented 2 years ago

1.4.0

Core

When transpiling in TypeScript the following warning is generated.

(!) Circular dependencies ..\node_modules\@iabtcf\core\lib\encoder\index.js -> ..\node_modules\@iabtcf\core\lib\encoder\SegmentEncoder.js -> ..\node_modules\@iabtcf\core\lib\encoder\field\index.js -> ..\node_modules\@iabtcf\core\lib\encoder\field\FieldEncoderMap.js -> ..\node_modules\@iabtcf\core\lib\encoder\field\VendorVectorEncoder.js -> ..\node_modules\@iabtcf\core\lib\encoder\index.js ..\node_modules\@iabtcf\core\lib\encoder\index.js -> ..\node_modules\@iabtcf\core\lib\encoder\SegmentEncoder.js -> ..\node_modules\@iabtcf\core\lib\encoder\field\index.js -> ..\node_modules\@iabtcf\core\lib\encoder\field\FieldEncoderMap.js -> ..\node_modules\@iabtcf\core\lib\encoder\field\VendorVectorEncoder.js -> D:\Workspace\paf-mvp-implementation\node_modules\@iabtcf\core\lib\encoder\index.js?commonjs-proxy -> ..\node_modules\@iabtcf\core\lib\encoder\index.js

The module is included with the following import.

import { TCString, TCModel, SegmentEncoder, Segment } from '@iabtcf/core/lib';

Do others have the same issue?

apfritts commented 2 years ago

yea, having the same issue. Did you have a chance to figure out how to fix it @jwrosewell?

jwrosewell commented 2 years ago

Thanks for confirming. Not yet looked at solving it. I'm concerned it's interfering with treeshaking and resulting in larger than required modules.

jwrosewell commented 2 years ago

Issues looks like it's related to this line.

https://github.com/InteractiveAdvertisingBureau/iabtcf-es/blob/49972aa9d6f8d1373a32ef2a759615e213388241/modules/core/src/encoder/field/VendorVectorEncoder.ts#L2

I don't have the time to get a build environment working to make a PR. Others?

marco-prontera commented 2 years ago

Hi @jwrosewell try the latest version 1.5.3 and tell me if there is still this problem. Read CONTRIBUTING.md to know how to start with the project ;)

krasnoperov commented 2 years ago

In my case it is still there:

Imports:

import type { GVL as GVLType, TCModel as TCModelType } from '@iabtcf/core'
import { TCModel, TCString, GVL } from '@iabtcf/core'
import { CmpApi } from '@iabtcf/cmpapi'
import cmpstub from '@iabtcf/stub'

Build output:

(!) Circular dependencies
node_modules/@iabtcf/core/lib/mjs/encoder/index.js -> node_modules/@iabtcf/core/lib/mjs/encoder/SegmentEncoder.js -> node_modules/@iabtcf/core/lib/mjs/encoder/field/index.js -> node_modules/@iabtcf/core/lib/mjs/encoder/field/FieldEncoderMap.js -> node_modules/@iabtcf/core/lib/mjs/encoder/field/VendorVectorEncoder.js -> node_modules/@iabtcf/core/lib/mjs/encoder/index.js
node_modules/@iabtcf/cmpapi/lib/mjs/response/index.js -> node_modules/@iabtcf/cmpapi/lib/mjs/response/Disabled.js -> node_modules/@iabtcf/cmpapi/lib/mjs/response/Response.js -> node_modules/@iabtcf/cmpapi/lib/mjs/CmpApiModel.js -> node_modules/@iabtcf/cmpapi/lib/mjs/EventListenerQueue.js -> node_modules/@iabtcf/cmpapi/lib/mjs/command/GetTCDataCommand.js -> node_modules/@iabtcf/cmpapi/lib/mjs/response/index.js
NevilleS commented 8 months ago

Yup, we see this too!

@iabtechlabtcf/core: version 1.5.10 @iabtechlabtcf/cmpapi: version 1.5.8

HeinzBaumann commented 8 months ago

-> @lamrowena

elliot-nelson commented 4 months ago

It looks like this is still an issue in 2024 -- with @iabtcf/core@1.5.6 (latest version I see in NPM).