-
I'm trying to add some custom fields by parsing a JSON file at the beginning of
The code uses the node.js modules 'url', 'fs' and 'path', but webpack 5 no longer includes support for them. The error messages are:
Where should I add the Or, even better, how can I run my initialisation code only when the static site is generated and not in the browser? Sorry if these are silly questions, my knowledge of webpack is close to none... :-( Thank you, Liviu |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
You can add
I don't even know what this means 😅 I can only advise on such things if I see a minimal repro. Here it's very unclear what you are trying to do. And I'm not even sure the error message you get is related. |
Beta Was this translation helpful? Give feedback.
-
That was useful. After this change, the code parsing the package.json is functional. It looks like this: And the code that uses the configuration looks like this:
This is a bit concerning. In my site there are a lot of files, all in markdown, that need to show the custom fields, and this is only the first of a set of +20 related sites, so if this is not recommended, and at a later time will no longer work, updating all sites will require quite a lot of work. So any solution that reduces this risk is welcome. (writing my own remark plugin is a bit too much). |
Beta Was this translation helpful? Give feedback.
-
We have some communication issues. The question was not how to write a minimal repro, the Playground page provides the buttons to create the minimal repro, and I assume the resulting projects are minimal. The question was how to use the tools that you recommend there, in such a way that they are useful for you. For example for CodeSandbox you should mention how to make the project public, and explain how to pass back a link to the project (the generated project permalinks are confusing). I also tried StackBlitz, but could not make it work, so probably there are more explanations needed for it. Otherwise, if you assume all users are experts in using these tools, don't be surprised if you get links to broken projects. |
Beta Was this translation helpful? Give feedback.
That was useful. After this change, the code parsing the package.json is functional. It looks like this:
And the code that uses the configuration looks like this:
This is a bit concerning. In my s…