tslib icon indicating copy to clipboard operation
tslib copied to clipboard

Deprecation warning in Node 16

Open magnihansen opened this issue 4 years ago • 5 comments

When building my Angular 12 library application i'm getting a new deprecation warning after updating to Angular 12.

My warning message (local folders): (node:9872) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\g\LogicmediaAngularNpm\logicmedia-angular\library-container-project\projects\logicmedia-angular\node_modules\tslib\package.json. Update this package.json to use a subpath pattern like "./".

I'm using [email protected] and Angular 12.1.1 I'm compiling my Angular library application using Ivy partial compilation mode.

🙁 Actual behavior My library application builds and my npm package can be published but publishing with red lines is not intended.

🙂 Expected behavior Angular not showing these red lines when building.

magnihansen avatar Jul 14 '21 07:07 magnihansen

I just triggered this on a new build, it's confusing though:

: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\g\LogicmediaAngularNpm\logicmedia-angular\library-container-project\projects\logicmedia-angular\node_modules\tslib\package.json.
Update this package.json to use a subpath pattern like "./".

Use of deprecated folder mapping "./" in the "exports" field... Update this package.json to use a subpath pattern like "./"

orta avatar Aug 09 '21 20:08 orta

My error message looks slightly different:

DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of 
the package at C:\...\node_modules\tslib\package.json.
Update this package.json to use a subpath pattern like "./*".

According to Node docs, it should just be replacing ./ with ./*.

    "exports": {
        ".": {
            "module": "./tslib.es6.js",
            "import": "./modules/index.js",
            "default": "./tslib.js"
        },
-       "./": "./"
+      "./*: "./*"
    }

Though I can't see the reason to export everything in the root. Mostly since there are pretty much no Javascript files to import. The only thing that might need to be exported as far as I know is package.json.

-       "./": "./"
+      "./package.json: "./package.json"

csvn avatar Aug 13 '21 21:08 csvn

i have the same issue on a svelte project because of some deep dependency. Would be good to have this warning gone

yonnic avatar Sep 08 '21 09:09 yonnic

This is a duplicate of #134. Would be nice to see fixed

LittleBigBug avatar Sep 27 '21 21:09 LittleBigBug

tslib now breaks in node 17:

Error loading `tslib` helper library.                                           
[!] Error: Package subpath './package.json' is not defined by "exports" in .../tslib/package.json

bmaland-visma avatar Oct 28 '21 10:10 bmaland-visma

Dupe of #134, fixed back in tslib 2.4.0.

jakebailey avatar Mar 03 '23 05:03 jakebailey