michael-brade / LaTeX.js

JavaScript LaTeX to HTML5 translator
https://latex.js.org
MIT License
736 stars 58 forks source link

Problem with library usage and Webpack #132

Closed etherealmachine closed 2 years ago

etherealmachine commented 2 years ago

There seems to be a problem with the dependency chain when using as a library with Webpack. From a fresh install with yarn add latex.js, I get version ^0.12.4, but during build I see: ModuleNotFoundError: Module not found: Error: Can't resolve './documentclasses' in '{elided}/node_modules/latex.js/dist'

It's possible there's a problem with my Webpack configuration, but I also noticed that the documentclasses folder is missing from latex.js/dist:

$ ls node_modules/latex.js/dist/
css  fonts  js  latex.js  latex.js.map  latex.mjs  latex.mjs.map
timothepearce commented 2 years ago

Same problem here!

TianMing2018 commented 2 years ago

try npm install latex.jx@0.12.1 related to use dynamic imports for external packages and documentclasses link: https://github.com/michael-brade/LaTeX.js/tree/v0.12.2

jorge-menjivar commented 2 years ago

It seems that although this issue was fixed, NPM did not pick up the update. Maybe because the previous and current version in package.json were both 0.12.4 (unchanged)?

The package downloaded from NPM still does not have the touch code,

"devbuild": "rimraf 'dist/**/*.map';mkdirp dist/css;mkdirp dist/js;mkdirp dist/fonts;mkdirp dist/documentclasses;mkdirp dist/packages;rsync -a src/css/ dist/css/;rsync -a src/fonts/ dist/fonts/;rsync -a node_modules/katex/dist/fonts/*.woff dist/fonts/;rsync -a src/js/ dist/js/;mkdirp bin;lsc -bc --no-header -m embedded -p src/cli.ls > bin/latex.js;chmod a+x bin/latex.js;rollup -c;",
michael-brade commented 1 year ago

@jorge-menjivar true, I didn't create a new release until yesterday... but now with 0.12.6 it should work.