How to handle mathlive.mjs with webpack
See original GitHub issueI was using https://github.com/sveltejs/template-webpack
And only one line, that is import 'mathlive'
, is added into App.svelte
<script>
import 'mathlive'
......
</script>
And When I run npm run dev
, it reports error:
ERROR in ./node_modules/mathlive/dist/mathlive.mjs 2:180267
Module parse failed: Unexpected token (2:180267)
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
| /* MathLive 0.53.3 */
<here is the code of mathlive ...>
Is there any required setup of webpack to use mathlive?
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (9 by maintainers)
Top Results From Across the Web
Add MathLive to your Project - CortexJS
Your bundler/transpiler (for example Rollup , WebPack , Babel , TypeScript ) will locate the MathLive library in the node_modules directory and ...
Read more >I would like to know how to install and use mathlive in NuxtJS
If I run nuxt webpack --dev , I can see an entry in the rules for .mjs . However, I still receive the...
Read more >Module Methods - webpack
Specify a whole group of dependencies using a path to the directory , an option to includeSubdirs , a filter for more fine...
Read more >How to transpile ES modules with webpack and Node.js
js runtime to treat JavaScript code as ESM, since the Node runtime treats JavaScript code as a CommonJS module by default. In this...
Read more >systemjs-webpack-interop - npm
systemjs -webpack-interop is an npm package that exports functions that help you create a webpack bundle that is consumable by SystemJS as an ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI, I have a fix pending that will remove the need for import.meta.url. I just need to do a bit more testing.
Two years later, but there is still an issue in the toolchain. Webpack 4, in particular, does not support the optional chaining operator (although all evergreen browser do). To work around this MathLive is now packaged differently:
mathlive.min.js
library is compiled targeting an older version of JavaScript that should be compatible with Webpack 4mathlive.min.mjs
library is compiled for up to date toolchains.So, if you run into errors integrating MathLive, try to use the
dist/mathlive.min.js
library.