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

Slate-bundled JS files generated as broken symlinks #25

Closed
Abion47 opened this issue Dec 16, 2020 · 3 comments
Closed

Slate-bundled JS files generated as broken symlinks #25

Abion47 opened this issue Dec 16, 2020 · 3 comments

Comments

@Abion47
Copy link

Abion47 commented Dec 16, 2020

Bug Description
As of 3.0.0-2, I am able to build and serve the documentation site successfully. However, there appears to be an error with several of the JS files from Slate that get generated, namely "imagesloaded.min.js", "jquery.min.js", and "lunr.min.js". The error seems to stem from the call to npx reslate init, where the code files that get generated are symlinks instead of the files themselves, and inspecting these symlinks reveals them to be broken. If I look in the "node_modules" directory for reslate, the source files for these files are broken symlinks as well.

The symlinks are copied to the output upon running npx reslate build, which results in several aspects of the final site not working properly. For example, the code snippet column shows the sample code from all languages at once, and clicking the language tabs does nothing.

Here is the directory of my API description after having only run npx reslate init (note the curled arrows by the aforementioned files indicating they are symlinks and inspecting the files results in a read error):

api file tree

And here is the resulting web page (note the code samples for Ruby, Python, Shell, and JavaScript are all being displayed simultaneously):

api site

And this is the console output from the web page (the errors regarding $ would be because the jQuery script isn't being loaded):

jquery.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
imagesloaded.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
lunr.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
jquery.highlight.js:46 Uncaught ReferenceError: jQuery is not defined
    at jquery.highlight.js:46
imagesloaded.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
lunr.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
lang.js:172 Uncaught ReferenceError: $ is not defined
    at lang.js:172
    at lang.js:180
search.js:36 Uncaught ReferenceError: $ is not defined
    at search.js:36
    at search.js:101
(index):32 Uncaught ReferenceError: $ is not defined
    at (index):32
@MikeRalphson
Copy link
Contributor

I am running Ubuntu 18.04.5 via WSL2.

Is this still true for this report? If you could tell me what the following symlinks are trying to point to, from your project-dir/node_modules/reslate/source/slate/js/lib it would be helpful:

imagesloaded.min.js
jquery.min.js
lunr.min.js

I'd also like to know whether you used npm, yarn or pnpm to install reslate?

@Abion47
Copy link
Author

Abion47 commented Dec 17, 2020

That is still true, though it's worth noting that if I try to run npm i reslate in Windows itself the symlink files don't appear at all.

Running readlink on the symlinks within the node_modules source files results in the command exiting with an error code and no output. Running chase outputs the following:

> chase imagesloaded.min.js
chase: /**project-dir**/node_modules/reslate/node_modules/imagesloaded: No such file or directory

> chase jquery.min.js
chase: /**project-dir**/node_modules/reslate/node_modules/jquery/dist: No such file or directory

> chase lunr.min.js
chase: /**project-dir**/node_modules/reslate/node_modules/lunr: No such file or directory

I have been using npm. Specifically npm 6.14.8.

@MikeRalphson
Copy link
Contributor

This should be fixed in reslate@3.0.0-3 which no longer uses symlinks for these files due to these cross-platform issues and 11ty support. Thanks again for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants