The Wayback Machine - https://web.archive.org/web/20201106140811/https://github.com/netlify/js-client/issues/87
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

How to use the UMD version in a webpack environment? #87

Open
riddla opened this issue Feb 14, 2020 · 1 comment
Open

How to use the UMD version in a webpack environment? #87

riddla opened this issue Feb 14, 2020 · 1 comment

Comments

@riddla
Copy link

@riddla riddla commented Feb 14, 2020

Hello there.

I'm trying to import the UMD version in a Vue project that is based on webpack respectively https://laravel.com/docs/6.x/mix. It ends up in the following error message:

netlify:15357 Uncaught Error: Module parse failed: Unexpected token (11:6)
You may need an appropriate loader to handle this file type.
|   if (isBinaryBody(parameters)) {
|     return {
|       ...opts,
|       body: bodyA,
|       headers: { 'Content-Type': 'application/octet-stream', ...opts.headers }

I'm trying to use it as follows:

import { NetlifyAPI } from "netlify";
const client = new NetlifyAPI(
  "[api_key]"
);

Did anybody have success with the webpack/UMD combination?

@ehmicky
Copy link
Contributor

@ehmicky ehmicky commented Feb 14, 2020

Hi @riddla

UMD builds are currently experimental and are unfortunately not working quite yet.

In your case, it seems like Webpack might be tripping up on the ... spread operator. Maybe this is because you are targeting browsers that do not support that operator? Or because you are not using Babel?

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.