Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Webpack cannot resolve 'fs' when bundling service client #2993

@AllanZhengYP

Description

@AllanZhengYP

Describe the bug

Running basic Webpack command on current master fails with:

Module not found: Error: Can't resolve 'os' in '/tmp/npm_size_1636138141606/@aws-sdk_client-s3/node_modules/@aws-sdk/shared-ini-file-loader/dist-es
...
Module not found: Error: Can't resolve 'fs' in '/tmp/npm_size_1636138141606/@aws-sdk_client-s3/node_modules/@aws-sdk/config-provider/dist-es
...

Your environment

SDK version number

Unreleased version

Is the issue in the browser/Node.js/ReactNative?

Browser/ReactNative

Steps to reproduce

webpack --entry [path to @aws-sdk/client-s3 index]

Observed behavior

Module not found error

Expected behavior

Package should be bundled without configuration by Webpack.

Additional context

This is caused by the package @aws-sdk/config-provider and @aws-sdk/middleware-bucket-endpoint now includes node-specific source code in their index now. They used to be runtime-agnostic. This change is likely to be introduced by #2947

Potential Fix

The mentioned packages' node specific source code are caused because they imports the booleanSelector from @aws-sdk/node-config-provider package. They booleanSelector itself doesn't require node specific utils. It can be splitted from the @aws-sdk/node-config-provider to a runtime-agnostic new package, say @aws-sdk/util-config-provider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions