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

api-console with react #680

Open
FranciscoGileno opened this issue Mar 18, 2021 · 3 comments
Open

api-console with react #680

FranciscoGileno opened this issue Mar 18, 2021 · 3 comments
Assignees

Comments

@FranciscoGileno
Copy link

Hi!

Congrats for this lib. It is great!

I am trying to make it run with a new instance of create-react-app. I already installed the package npm -i --save api-console, and my code is:

import "api-console";

import "./App.css";

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <api-console
          style={{ height: "400px" }}
          modelLocation="/api-model.json"
        />
      </header>
    </div>
  );
}

export default App;

I've got: Uncaught SyntaxError: Identifier 'module' has already been declared

It seems create-react-app and api-console both declared module?

Can anyone help me?
Thanks.

@jarrodek
Copy link
Contributor

Hi,

Thank you for the issue report. I am not expert in react but I believe you should have reference the component registration file which is api-console/api-console.js so the final import would be:

import 'api-console/api-console.js';

There's no module in this project that would cause this error. If this won't help I'll ask @twoplustwoone to help you as he has more experience with React

@FranciscoGileno
Copy link
Author

Thanks for answering @jarrodek .

It didn't work. Same error.

@jarrodek
Copy link
Contributor

I see the problem. The icons library has an icon that is called module. It exports a variable with that name. After webpack compilation there is a function argument called module and then const declaration with the same name. This causes SyntaxError. I though webpack is smarter than that.
I can actually change the name of the icon as it is not yet widely used but it will take time.

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

3 participants