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 4 import fails #78

Closed
RafalDardzinski opened this issue Feb 14, 2023 · 2 comments
Closed

Webpack 4 import fails #78

RafalDardzinski opened this issue Feb 14, 2023 · 2 comments

Comments

@RafalDardzinski
Copy link

I'm using webpack@4.46.0 along with typescript@4.9.5 . I'm trying to use @cortex-js/compute-engine@0.12.2. When I try to import ComputeEngine according to the documentation...
import { ComputeEngine } from "@cortex-js/compute-engine/dist/compute-engine.min"

...I get an error on build:
ERROR in ./node_modules/@cortex-js/compute-engine/dist/compute-engine.min.js 2:42147 Module parse failed: Unexpected token (2:42147) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | /** CortexJS Compute Engine 0.12.2 */

I thought it's something with my webpack config, but the problem also occurs on newly setup project with basic webpack configuration that supports typescript. On the side-note, importing mathlive works fine.

@kobelinh24
Copy link

I'm trying to do import '@cortex-js/compute-engine'; while building a web component, also got the same error while compiling:
../node_modules/@cortex-js/compute-engine/dist/compute-engine.min.esm.js 2:42173 Module parse failed: Unexpected token (2:42173) You may need an appropriate loader to handle this file type.

Mathlive indeed works as indicated.

Any update on this as this long-opened issue?

@arnog
Copy link
Member

arnog commented Jul 31, 2023

I haven't investigated this issue. It would help if someone could provide code that reproduces the problem.

That said, I suspect it's related to the fact that Webpack 4 does not support optional chaining (the ?. operator). Webpack 5 should support it, though.

See webpack/webpack#10227 (comment) for a discussion on a possible workaround.

@arnog arnog closed this as completed Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants