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

Can't build with webpack #169

Closed
diogosantosmendes opened this issue Apr 7, 2021 · 6 comments · Fixed by #171
Closed

Can't build with webpack #169

diogosantosmendes opened this issue Apr 7, 2021 · 6 comments · Fixed by #171

Comments

@diogosantosmendes
Copy link

I'm trying to build my project with @msgpack/msgpack@2.5.1 and that is not possible (error log bellow),

when I downgrade to version 2.2.1 it works again, do you understand why is that?

Can't import the named export '__asyncGenerator' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs 12:11-27
Can't import the named export '__asyncGenerator' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 142:35-48
Can't import the named export '__asyncValues' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 213:35-48
Can't import the named export '__asyncValues' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 215:49-56
Can't import the named export '__await' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 234:45-52
Can't import the named export '__await' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 261:45-52
Can't import the named export '__await' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs 24:41-48
Can't import the named export '__await' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs 28:41-48
Can't import the named export '__await' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs 32:41-48
Can't import the named export '__await' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs 7:11-20
Can't import the named export '__awaiter' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 133:15-24
Can't import the named export '__awaiter' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 32:4-13
Can't import the named export '__extends' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs 9:15-26
Can't import the named export '__generator' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 114:15-26
Can't import the named export '__generator' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 135:19-30
Can't import the named export '__generator' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs 205:19-30
Can't import the named export '__generator' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts

ERROR in ./node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs 14:15-26
Can't import the named export '__generator' from non EcmaScript module (only default export is available)
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs
 @ ./node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs
 @ ./src/services/helpers/rabbitmq.ts
 @ ./src/index.ts
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! cma-sidecar@2.1.0 build: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the cma-sidecar@2.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-04-07T16_47_29_571Z-debug.log

and here is my webpack config:

const { NODE_ENV = "production" } = process.env;
module.exports = {
  entry: path.resolve(__dirname, "src", "index.ts"),
  mode: NODE_ENV,
  target: "node",
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "bundle.js",
  },
  resolve: {
    extensions: [".ts", ".js"],
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: ["ts-loader"],
      },
    ],
  },
};
@diogosantosmendes
Copy link
Author

I changed my import from "@msgpack/msgpack" to "@msgpack/msgpack/dist" and it worked for me

@gfx
Copy link
Member

gfx commented Apr 9, 2021

Thank you for your report. It seems definitely a packaging bug in this module. Will look into it on the weekend.

@weijian-zhu
Copy link

I changed my import from "@msgpack/msgpack" to "@msgpack/msgpack/dist" and it worked for me

so good,thanks

@kachkaev
Copy link

kachkaev commented Apr 9, 2021

Same here after upgrading from 2.4.1 to 2.5.1. Replacing import { .... } from "@msgpack/msgpack" with import { .... } from "@msgpack/msgpack/dist" helped indeed.

I’m gonna stay on 2.4.1 for now. Big thanks for volunteering to look into the issue @gfx! 👍

@kachkaev
Copy link

@gfx 🙏

@gfx gfx changed the title Can´t build with webpack Can't build with webpack Apr 21, 2021
gfx added a commit that referenced this issue Apr 21, 2021
gfx added a commit that referenced this issue Apr 21, 2021
@gfx gfx closed this as completed in #171 Apr 21, 2021
@gfx
Copy link
Member

gfx commented Apr 21, 2021

Sorry to be late! Released v2.6.0 that includes the fix by reverting the use of tslib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants