-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Error when using symlinked docs folder: Module parse failed: Assigning to rvalue #3272
Comments
I have no idea what's going on but it works for me. Can someone reproduce this consistently? Can you try with yarn instead of npm? (both works for me) Have you modified anything at all of the generated project? Are you sure you are in the correct directory? I see you created |
Hey @slorber I just tried this on another machine (also Windows) and it worked fine. So you may be right - it might just be my env. To answer your questions, though - I didn't modify anything in the generated project. And I was in the correct directory (the initial command using |
Ok great to know. Not sure what I can do about this issue, so I'm closing, but let's reopen it if other users are affected and we get more info. |
Hi @slorber I`m trying to use version feature with docusaurus v2 (2.0.0-alpha.61) and get the same error: × Client
Compiled with some errors in 150.24ms
./versioned_docs/version-1.1.0/doc1.md 1:2
Module parse failed: Assigning to rvalue (1:2)
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
> ---
| id: doc1
| title: Style Guide
@ ./.docusaurus/registry.js 1:4301-4368 1:4145-4253
@ ./node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js
@ ./.docusaurus/routes.js
@ ./node_modules/@docusaurus/core/lib/client/clientEntry.js
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./node_modules/@docusaurus/core/lib/client/clientEntry.js./versioned_docs/version-1.1.0/doc2.md 1:2
Module parse failed: Assigning to rvalue (1:2)
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
> ---
| id: doc2
| title: Document Number 2
@ ./.docusaurus/registry.js 1:4746-4813 1:4590-4698
@ ./node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js
@ ./.docusaurus/routes.js
@ ./node_modules/@docusaurus/core/lib/client/clientEntry.js
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./node_modules/@docusaurus/core/lib/client/clientEntry.js./versioned_docs/version-1.1.0/doc3.md 1:2
Module parse failed: Assigning to rvalue (1:2)
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
> ---
| id: doc3
| title: This is Document Number 3
@ ./.docusaurus/registry.js 1:5373-5440 1:5218-5325
@ ./node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js
@ ./.docusaurus/routes.js
@ ./node_modules/@docusaurus/core/lib/client/clientEntry.js
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./node_modules/@docusaurus/core/lib/client/clientEntry.js./versioned_docs/version-1.1.0/mdx.md 1:2
Module parse failed: Assigning to rvalue (1:2)
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
> ---
| id: mdx
| title: Powered by MDX
@ ./.docusaurus/registry.js 1:5809-5875 1:5657-5762
@ ./node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js
@ ./.docusaurus/routes.js
@ ./node_modules/@docusaurus/core/lib/client/clientEntry.js
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./node_modules/@docusaurus/core/lib/client/clientEntry.js
|
Hi, Can you give us more infos on your env? Are you both on Windows? Wonder if you use a fs path with spaces in it or something? That can lead to issues sometimes. |
I'm running into the same issue, when trying to use files that a symlink in from another directory. Are you aware of any issues with symlinks? My errors look like this
|
It almost seems that docusaurus isn't finding the files and compiling them from markdown into js files? Or maybe webpack can't handle symlinks? I don't have enough background to really say. |
It may have something to do with this webpack/webpack#1643 |
Yes! @CyborgMaster this is what fixed it for me. For me, my user folder I assume what you're thinking is correct - that webpack doesn't understand symbolic links. Somehow some of the files are not being found. |
Thanks for reporting this. Do you think we can do anything about it? Note we have this By using a local site plugin + configureWebpack you should be able to override any default setting we set, so maybe it's worth checking if you find a final config that works for your usecase? |
Not sure how to fix this. I've tried creating a |
@kewp we don't read any webpack.config.js file. The doc to create a local plugin is very simple: I think something like that: module.exports = function(context, options) {
return {
name: "custom-docusaurus-plugin",
configureWebpack(config, isServer, utils) {
return {
resolve: {
symlinks: false
}
};
}
};
}; |
Hi @slorber . Yup that worked too :) |
@slorber, that worked for me too. I added the plugin you provided in your comment and now the symlinked files work. I'm obviously not understanding something here, but it feels completely backwards to me that in order to get docs that are symlinked in to work we have to set Thanks for you help! This may be super specific to our setup so I don't know if it belongs in the docusaurus docs or not, but it was certainly tricky to figure out. |
Also saw this webpack setting and found it confusing, but as far as I understand it, true means webpack will try to "replace" the symlink by its real location, not that it will enable some kind of mode that works with symlinks. I don't know either why in Docusaurus we have symlinks: true exactly, not sure we'll be able to know now |
Another issue with this symlinks error: #3579 Maybe we should consider switching symlinks to false by default. Not sure about the impact of this, so we'd rather be prepared to revert if users report bugs after release |
Set In the latest version of watchpack (v2.x), it added a |
The above workaround does not appear to work any longer. I'm running into the same error now, with docusaurus 2.0.0-beta.0 and symlinks out to ../site/* for my Might this be due to the updates to webpack v5.x that have been implemented? Does anyone know of a workaround for the current docusaurus? |
To clarify: the plugin workaround does work for |
Maybe worth trying updating the You can edit the I don't think you can change this with current apis , but maybe the following works? module.exports = function(context, options) {
return {
name: "custom-docusaurus-plugin",
configureWebpack(config, isServer, utils) {
return {
resolve: {
symlinks: false
},
devServer: {
watchOptions: { followSymlinks: false }
}
};
}
};
}; |
@slorber it does not seem to work, sadly. |
FWIW I just had the exact same issue after upgrading to Removing |
I have the same problem and
|
yes, we can now pass plugins as inline config functions :) I'm not sure to understand why we have |
FYI I coudn't find any reason to use Going to revert to false in #5126 Using a symlinked folder as source docs seems to work fine (in dev/watchmode + prod) Using symlinks inside the regular docs folder does not really work, and probably require more work so that features such as auto-generated sidebars etc work as intended. Do you all have the same use-case to create a single symlink for the root docs folder? |
I see it the same way, users should be able to use symlinked docs folder.
I'm going to use it this way, I hope that this was only one problem which I come across. I'm going to use it this way because I want to have documentation to be a part of the main project and create a new repository for the docusaurus. So I will have two repos, main project eg.
Nice thank you 🙏 For me it makes sense. |
That's very much like my use case as well, just to say. |
great, we'll figure out later if using symlinks inside the docs root folder is necessary. If you have this need please explain your usecase. I've added a new docs plugin instance using a root symlink so that we keep this behavior working over time. CI builds fine on linux/windows: https://deploy-preview-5126--docusaurus-2.netlify.app/docs-tests |
Unfortunately, I have to revert the change I made (#5164). There is a bug in Webpack 5 caching and using If you implement a Docusaurus plugin as part of a monorepo and change some UI code, your new deployment (dev + prod) may not see your changes. Not many sites will be affected by this in practice (theme components should be fine fine), but it's particularly painful for ourselves: Docusaurus PR Netlify deploy previews show stale UI components. If you decide to stick to using Also, I'm not sure using I'd like to recommend another workaround: instead of using [
'@docusaurus/plugin-content-docs',
{
routeBasePath: 'docs',
sidebarPath: 'sidebars.js',
path: fs.realpathSync('docs-symlink'),
},
], Please let me know if this workaround works for your site. We'll only try to apply |
Can confirm on this. With FYI - I am not using a docusaurus plugin. Just changing |
If one has a docs multi-instance and wants to share a directory with partials between two docs instances, would the symlink approach work? |
@leograba the canary now allows putting mdx docs anywhere (#5299) so you shouldn't need symlinks anymore: just import the mdx files where you want to use them. However keep in mind the link resolution in those partials is "simpler", it doesn't resolve relative md file paths but only regular relative/abslute links. Also there's a TOC limitation (#3915) |
@slorber thanks! I have tested it with the canary release About the link resolution, I have previously noticed that that the "simpler" link resolution also affects referring to a different doc in a multi-docs setup, so I've been already using relative links. I'll keep in mind the limitations of relative links instead of relative file paths. About the TOC, keeping an eye on (#3915) :) |
Yes, only the docs plugin resolve relative md file paths currently and it's limited to the scope of a single instance. We need some additional infrastructure so that plugins can expose to each others a |
The Webpack 5 caching bug should be resolved in webpack/webpack#14019 |
🐛 Bug Report
Tried to run the 'classic' template following the getting started steps https://v2.docusaurus.io/docs/installation
Failed when running
npm run start
. Lots of errors. (only showing partial log)Your Environment
The text was updated successfully, but these errors were encountered: