From 99186c442564d6e83bbe1f65265452b319483a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20W=C3=B3dkiewicz?= Date: Mon, 5 Feb 2024 11:22:40 +0100 Subject: [PATCH] fix: rename lib.js to lib.web.js This fixes TypeScript support for NodeNext/Node16/Bundler moduleResolution. The issue was that the ./dist/lib.js had a higher precedence than ./dist/lib/index.d.ts when TypeScript tried to resolve "./lib" imports/exports. Instead of renaming the whole lib/ folder I decided to add a infix to the lib.js artifact. But to solve the issue you could've renamed the directory instead. --- .github/workflows/publish-casper-client-sdk.yml | 2 +- package.json | 2 +- webpack.config.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-casper-client-sdk.yml b/.github/workflows/publish-casper-client-sdk.yml index b6d991488..ba0f7d342 100644 --- a/.github/workflows/publish-casper-client-sdk.yml +++ b/.github/workflows/publish-casper-client-sdk.yml @@ -32,7 +32,7 @@ jobs: - name: Get latest release version number id: get_version uses: battila7/get-version-action@d97fbc34ceb64d1f5d95f4dfd6dce33521ccccf5 #v2.3.0 - - run: cp dist/lib.js casper-js-sdk.v${{ steps.get_version.outputs.version }}.js + - run: cp dist/lib.web.js casper-js-sdk.v${{ steps.get_version.outputs.version }}.js - uses: meeDamian/github-release@7ae19492500104f636b3fee4d8103af0fed36c8e #v2.0.3 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index f6f81a5c3..3e444847a 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "url": "https://github.com/casper-ecosystem/casper-js-sdk.git" }, "main": "dist/lib.node.js", - "browser": "dist/lib.js", + "browser": "dist/lib.web.js", "types": "dist/index.d.ts", "scripts": { "prepare": "husky-run install", diff --git a/webpack.config.js b/webpack.config.js index 9c8846c78..590bf4065 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -70,7 +70,7 @@ const clientConfig = { ], output: { path: path.resolve(__dirname, 'dist'), - filename: 'lib.js', + filename: 'lib.web.js', libraryTarget: 'umd' } };