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

[Javascript] Webpack 3.0 unexpected token === #5975

Open
darylteo opened this issue Jul 4, 2017 · 1 comment
Open

[Javascript] Webpack 3.0 unexpected token === #5975

darylteo opened this issue Jul 4, 2017 · 1 comment

Comments

@darylteo
Copy link

darylteo commented Jul 4, 2017

Description

Just helping any internet searchers coming around until Webpack fixes this.

If you are

  • using Webpack 3
  • with parser.amd = false as per the Readme

You will run into this issue webpack/webpack#5198.

The problematic line for me is in ApiClient.prototype.isFileParam.

    if (typeof window === 'undefined' &&
        typeof require === 'function' && // <------ here
        require('fs') &&
        param instanceof require('fs').ReadStream) {
      return true;
    }
Swagger-codegen version

Tried with 2.2.0 and 2.2.2.

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
  • require() Swagger generated files from Webpack 3.
Related issues
Suggest a Fix

Go back to the old hack using imports-loader?define=false which still works until the bug is fixed.

@wing328
Copy link
Contributor

wing328 commented Jul 4, 2017

@darylteo thanks for sharing the workaround.

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

No branches or pull requests

2 participants