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

Webpack: Cannot statically analyse 'require(…, …)' #317

Open
lord-pendragon opened this issue Jan 10, 2022 · 3 comments
Open

Webpack: Cannot statically analyse 'require(…, …)' #317

lord-pendragon opened this issue Jan 10, 2022 · 3 comments

Comments

@lord-pendragon
Copy link

image

Description: Using Asciidoctor's Kroki extension with Webpackv4 results in the following error

How to Reproduce:

  1. Make a React-App

  2. Add the following dependencies to packages.json:
    "asciidoctor": "^2.2.5",
    "asciidoctor-kroki": "^0.15.4",
    "highlight.js": "11.4.0",
    "sanitize-html": "2.6.1",
    "webpack": "^4.0.0"

  3. Add AsciiDoctor.jsx to your project

  4. Import AsciiDoctor into App.jsx and use it as

  5. npm start: You will see the issue

Repo: https://github.com/lord-pendragon/ascii-krokii-webpack-issue

@ggrossetie
Copy link
Member

Line 29 in dist/browser/asciidoctor-kroki.js is an empty line: https://github.com/Mogztter/asciidoctor-kroki/blob/dd6b5708d87a60166fc8c0e018a12b5c026aac02/dist/browser/asciidoctor-kroki.js#L29

I can reproduce this issue using the following steps:

  1. npx create-react-app asciidoctor-kroki-react-scripts
  2. cd asciidoctor-kroki-react-scripts
  3. npm i @asciidoctor/[email protected] [email protected]
  4. Edit src/App.js, add the following import:
import Asciidoctor from '@asciidoctor/core'
import kroki from 'asciidoctor-kroki'
  1. Save and run npm start

image

Having said that, I have absolutely no idea how to solve this issue since the error message does not help. You should probably ask the Webpack team:

@lord-pendragon
Copy link
Author

That's a shame, will raise this with the Web-pack Team, can close the issue if you wish to do so.
Will inform on any updates from Web-pack devs.

@ggrossetie
Copy link
Member

ggrossetie commented Jan 10, 2022

Thanks, I will keep this issue open until we found the root cause.

@lord-pendragon Feel free to link this issue if there's a corresponding GitHub issue upstream.

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