Skip to content

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

Open
@darylteo

Description

@darylteo
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions