Issue with source map in v0.2.37 when running with Vite
When running the project with Vite, it's throwing this error: (It doesn't prevent Vite from running, it's just annoying)
VITE v5.2.11 ready in 257 ms
➜ Local: http://localhost:7860/
➜ Network: http://172.19.0.2:7860/
✘ [ERROR] Expected "," in source map but found "MLC_DUMMY_REQUIRE_VAR"
node_modules/@mlc-ai/web-llm/lib/index.js.map:1:212952:
1 │ ...st performanceNode = "MLC_DUMMY_REQUIRE_VAR";\r\n ret...
│ ~~~~~~~~~~~~~~~~~~~~~
╵ ,
The source map "node_modules/@mlc-ai/web-llm/lib/index.js.map" was referenced by the file "node_modules/@mlc-ai/web-llm/lib/index.js" here:
node_modules/@mlc-ai/web-llm/lib/index.js:8190:21:
8190 │ //# sourceMappingURL=index.js.map
╵ ~~~~~~~~~~~~
Temporary solution: remove the //# sourceMappingURL=index.js.map line from @mlc-ai/web-llm/lib/index.js before compiling and Vite won't throw any errors.
Extra info: The v0.2.35 didn't have this problem.
Thanks for reporting the error, will send a fix soon
Could you try 0.2.38? Should be fixed via https://github.com/mlc-ai/web-llm/pull/415. Apologies for the inconvenience
Thanks for the quick response, @CharlieFRuan!
I've installed v0.2.38 and noticed a difference already, but now the error is in another place of index.js.map:
I've manually replaced all occurrences of "MLC_DUMMY_PATH" with \"MLC_DUMMY_PATH\" in the source map and confirmed it runs without that error.
So using the same solution from #415 for this variable should work. (Proposed in #420)
Sorry, @CharlieFRuan and @tqchen,
It seems the fix on https://github.com/mlc-ai/web-llm/pull/420 didn't solve the problem with "MLC_DUMMY_PATH".
I just confirmed that this issue is present on v0.2.39:
I also double-checked it on https://www.npmjs.com/package/@mlc-ai/web-llm?activeTab=code and we can see the issue is there on v0.2.39 release:
Can we re-open this issue, and could you confirm why the change on #420 didn't fix it?
Ahh thanks for the catch; this should be due to how we need ' instead of ". Will send a patch now and fix in 0.2.40
Could you try 0.2.40 which includes https://github.com/mlc-ai/web-llm/pull/440?
Thank you! Now it's fixed! 🎉
Confirmed here:
And also by removing the workaround I had for the issue.