Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error "'parse' is not exported by node_modules/bowser/src/bowser.js" with snowpack #1992

Closed
trivikr opened this issue Feb 2, 2021 · 2 comments · Fixed by #1991
Closed
Labels
bug This issue is a bug.

Comments

@trivikr
Copy link
Member

trivikr commented Feb 2, 2021

Describe the bug

aws-sdk-js-v3 throws the following error when build is performed using snowpack

[snowpack] Failed to load node_modules/@aws-sdk/util-user-agent-browser/dist/es/index.js
  'parse' is not exported by node_modules/bowser/src/bowser.js, imported by node_modules/@aws-sdk/util-user-agent-browser/dist/es/index.js
[snowpack] Install failed.

Your environment

SDK version number

@aws-sdk/[email protected]
[email protected]

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

Node.js & Browser

Details of the browser/Node.js/ReactNative version

Tested with Node.js v14.15.4

Steps to reproduce

Quick test for bundling:

package.json
{
  "name": "test-snowpack",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "type": "module",
  "devDependencies": {
    "snowpack": "^3.0.11"
  },
  "dependencies": {
    "@aws-sdk/client-dynamodb": "^3.4.1"
  }
}
index.js
import { DynamoDB } from "@aws-sdk/client-dynamodb";

const client = new DynamoDB({});
console.log(await client.listTables({ Limit: 1 }));

The command run to test snowpack bundling:

./node_modules/.bin/snowpack build

Observed behavior

The following error is thrown:

[snowpack] Hint: run "snowpack init" to create a project config file. Using defaults...
[snowpack] ! building source files...
[snowpack] ✔ build complete [0.13s]
[snowpack] ! building dependencies...
[snowpack] Failed to load node_modules/@aws-sdk/util-user-agent-browser/dist/es/index.js
  'parse' is not exported by node_modules/bowser/src/bowser.js, imported by node_modules/@aws-sdk/util-user-agent-browser/dist/es/index.js
[snowpack] Install failed.

Expected behavior

Snowpack build is successful.

Additional context

Discussion on snowpack repo: FredKSchott/snowpack#2114
Issue noticed in todo app: aws-samples/aws-sdk-js-notes-app#2 (comment)

@trivikr trivikr added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 2, 2021
@trivikr
Copy link
Member Author

trivikr commented Feb 2, 2021

This is an issue with manually written types in bowser which falsely state that named imports are available for the module. Details in bowser-js/bowser#458

As per README in bowser, we should use default import https://github.com/lancedikson/bowser#use-cases
We currently use named import in

import { parse } from "bowser";

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant