Skip to content

Issue with packages that do no export a default #71

@leibowitz

Description

@leibowitz

I'm having an issue processing a certain package with this plugin, namely stream-chat

It seems they do not have a default export, which means it requires to be imported in this way:

import { StreamChat } from 'stream-chat';

And I don't know how to translate that to webpack-cdn-plugin. I don't seem to get it to work. According to the doc, var need to be specified – otherwise stream-chat breaks as it's not a valid variable name.

external_"stream-chat":1 Uncaught ReferenceError: stream is not defined

From this code:

/*!******************************!*\
  !*** external "stream-chat" ***!
  \******************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = stream-chat;\n\n//# sourceURL=webpack:///external_%22stream-chat%22?");

I tried setting it with 'var': 'StreamChat', which seems to pass the previous error, but then it fails with another error:

stream_chat__WEBPACK_IMPORTED_MODULE_1__.StreamChat is not a constructor

When it tries to replace StreamChat in the code with:

stream_chat__WEBPACK_IMPORTED_MODULE_1__["StreamChat"]

I believe the issue is because the package do not export itself properly, and I would like to report the issue with the project, but I don't know how to phrase it. Any help to understand what's needed would be appreciated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions