Closed monken closed 1 year ago
Generally speaking it seems that some bundlers might have issues with the export * from
syntax used in many places. Explicit exports seem to resolve this specific issue and make three-shaking more efficient.
Hi @monken
Can you elaborate which export * from
exactly is causing this issue?
The immediate export * from
is defined in https://github.com/aws/aws-sdk-js-v3/blob/master/packages/node-http-handler/src/index.ts. Were you able to reproduce the issue with my test repo?
All AWS SDK v3 packages are exported as ESM in 1.0.0-gamma.3
However, a new error appears with rollup using @aws-sdk/client-sts@1.0.0-gamma.3
@aws-sdk/protocol-http (imported by node_modules/@aws-sdk/client-sts/dist/es/protocols/Aws_query.js)
[!] Error: 'parse' is not exported by node_modules/fast-xml-parser/src/parser.js, imported by node_modules/@aws-sdk/client-sts/dist/es/protocols/Aws_query.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
node_modules/@aws-sdk/client-sts/dist/es/protocols/Aws_query.js (4:9)
Code in https://github.com/trivikr/js-sdk-v3-rollup/tree/gamma
Also getting the same error when bundling with Rollup. Any ideas on how to fix?
Error: '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
I've since switched to https://esbuild.github.io/ which can deal with @aws-sdk just fine (and is blazingly fast).
Revisiting this issue while examining xml-parser issues.
Tested rollup bundling with @aws-sdk/client-sts@3.9.0
in https://github.com/trivikr/js-sdk-v3-rollup/tree/test-3.9.0
The new error is due to v4 from uuid:
Error: 'v4' is not exported by node_modules/uuid/index.js, imported by node_modules/@aws-sdk/middleware-retry/dist/es/defaultStrategy.js
at error (/Users/trivikr/workspace/js-sdk-v3-rollup/node_modules/rollup/dist/shared/rollup.js:161:30)
at Module.error (/Users/trivikr/workspace/js-sdk-v3-rollup/node_modules/rollup/dist/shared/rollup.js:15027:16)
Error when using @aws-sdk/client-lex-runtime-v2
in my lib and generating bundle using rollup
[build:bundles] [!] Error: 'parse' is not exported by node_modules\fast-xml-parser\src\parser.js, imported by node_modules\@aws-sdk\client-sts\dist\es\protocols\Aws_query.js
[build:bundles] https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
[build:bundles] node_modules\@aws-sdk\client-sts\dist\es\protocols\Aws_query.js (5:9)
[build:bundles] 3: import { expectNonNull as __expectNonNull, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, getValueFromTextNode as __getValueFromTextNode, parseRfc3339DateTime as __parseRf
c3339DateTime, strictParseInt32 as __strictParseInt32, } from "@aws-sdk/smithy-client";
[build:bundles] 4: import { decodeHTML } from "entities";
[build:bundles] 5: import { parse as xmlParse } from "fast-xml-parser";
[build:bundles] ^
[build:bundles] 6: export var serializeAws_queryAssumeRoleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
[build:bundles] 7: var headers, body;
[build:bundles] Error: 'parse' is not exported by node_modules\fast-xml-parser\src\parser.js, imported by node_modules\@aws-sdk\client-sts\dist\es\protocols\Aws_query.js
using "@rollup/plugin-node-resolve": "^13.0.5"
,
src/lambda.ts → dist/debug/lambda.js, dist...
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules\cronstrue\dist\cronstrue.js
8: else
9: root["cronstrue"] = factory();
10: })(typeof self !== 'undefined' ? self : this, function() {
^
11: return /******/ (function(modules) { // webpackBootstrap
12: /******/ // The module cache
[!] Error: 'parse' is not exported by node_modules\fast-xml-parser\src\parser.js, imported by node_modules\@aws-sdk\client-sts\dist\es\protocols\Aws_query.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
node_modules\@aws-sdk\client-sts\dist\es\protocols\Aws_query.js (5:9)
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.
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.
Describe the bug I'm trying to use rollup to create a deployable bundle for Lambda.
SDK version number beta-5
Is the issue in the browser/Node.js? Node.js
Details of the browser/Node.js version 12
To Reproduce (observed behavior)
Expected behavior I expect rollup to find and resolve all dependencies.
Screenshots