question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`import.meta` causes issues

See original GitHub issue

The latest versions of mathlive include the import.meta-syntax in its output *.mjs-file. There’s a couple of issues with that:

  • I am not sure that’s supposed to end up in the compilation result. AFAIU the import.meta.url should point to the location of the single module where it’s included (src/core/fonts.ts). By including it into the compilation-result, it will point to mathlive.mjs (and to wherever that is located as a dependency relative to the using application).
  • The syntax is not well supported by babel yet and therefore the using application fails to compile then. There are plugins for babel to support it, but those cannot easily be used if tools like create-react-app are used.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:24 (22 by maintainers)

github_iconTop GitHub Comments

3reactions
arnogcommented, Aug 17, 2020

mathlive@0.55.0 no longer uses import.meta.

Some more detailed instructions on how to integrate mathlive with Webpack can be found here http://cortexjs.io/guides/mathfield-getting-started/

Note that the default name of the distribution library has changed from “mathlive.js” and “mathlive.mjs” to “mathlive.min.js” and “mathlive.min.mjs”

3reactions
arnogcommented, Jun 30, 2020

I have some ideas on how to address this. I need to do some more testing, but I’ll give an update soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESlint - import.meta causes Fatal Parsing Error - Stack Overflow
@Bergi : I think you've discovered my issue. I'm setting the parser with eslint.parserOptions.parser = 'babel-eslint' . However, I should be ...
Read more >
import.meta.resolve() - Chrome Platform Status
import.meta.resolve(specifier) returns the URL to which the given specifier would resolve in the context of the current script.
Read more >
import.meta - JavaScript - MDN Web Docs
The import.meta meta-property exposes context-specific metadata to a JavaScript module. It contains information about the module, ...
Read more >
rollup.js
Importing CommonJS · Publishing ES Modules ... This is not a problem caused by Rollup putting the import at the top of the...
Read more >
Content Types - ESBuild
import.meta, es2020, import.meta ... It only causes compatibility problems for CommonJS modules that used to be ES modules (i.e. when __esModule is present) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found