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

HandyCollapse() is not a constructor #28

Closed
blocksera opened this issue Nov 16, 2021 · 1 comment
Closed

HandyCollapse() is not a constructor #28

blocksera opened this issue Nov 16, 2021 · 1 comment

Comments

@blocksera
Copy link

When building a Vue component with Rollup, the error HandyCollapse is not a constructor is thrown in the browser.
It works though when called like this: new HandyCollapse.default(). After some digging, the problem is fixed if the module is built with webpack configuration below.

/* webpack.confg.js */
output: {
        path: esmOutputPath,
        publicPath: publicPath,
        filename: "[name].js",
        library: {
            type: 'umd',
            name: 'HandyCollapse',
            export: 'default',
            umdNamedDefine: true
        }
    }

Thought we'd share for anyone running into the same issue.

@sk-rt
Copy link
Owner

sk-rt commented Nov 19, 2021

@blocksera
Thank you for the useful issue.

This library is built as common js , but it looks like it's being read as an es module.

I plan to support ESM in the near future.
Once that is done, you will be able to choose which format is best for you to use.

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

No branches or pull requests

2 participants