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

Docusaurus 3.0 + TinaCMS 1.5.28 not working #13

Open
juliolugo96 opened this issue Jan 15, 2024 · 5 comments
Open

Docusaurus 3.0 + TinaCMS 1.5.28 not working #13

juliolugo96 opened this issue Jan 15, 2024 · 5 comments

Comments

@juliolugo96
Copy link

Hi, guys!

I'm struggling to create a build of Tinasaurus with the following setup:

  • Gitlab as git provider
  • MongoDB as database adapter
  • NextJS as backend
  • Self-hosted

After I run yarn build I get the following errors:

...
--------------------------

Module not found: Error: Can't resolve 'querystring' in '/home/julio/workspace/pt/mikado/decap-mikado-docs/node_modules/openid-client/lib/helpers'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
	- install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "querystring": false }

--------------------------

Module not found: Error: Can't resolve 'http' in '/home/julio/workspace/pt/mikado/decap-mikado-docs/node_modules/openid-client/lib/helpers'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
	- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "http": false }

--------------------------

Module not found: Error: Can't resolve 'https' in '/home/julio/workspace/pt/mikado/decap-mikado-docs/node_modules/openid-client/lib/helpers'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
	- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "https": false }

--------------------------

Module not found: Error: Can't resolve 'crypto' in '/home/julio/workspace/pt/mikado/decap-mikado-docs/node_modules/scmp'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
	- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "crypto": false }

--------------------------

Module not found: Error: Can't resolve 'stream' in '/home/julio/workspace/pt/mikado/decap-mikado-docs/node_modules/socks/build/common'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
	- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "stream": false }

--------------------------

Module not found: Error: Can't resolve 'crypto' in '/home/julio/workspace/pt/mikado/decap-mikado-docs/node_modules/@tinacms/graphql/dist'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
	- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "crypto": false }

--------------------------

Attempted import error: 'fileURLToPath' is not exported from 'url' (imported as 'fileURLToPath').
error Command failed with exit code 1.

So, I solved this using a polyfill with Webpack, like this one (tinacms build works after this)

const webpack = require("webpack");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");

module.exports = function (context, options) {
  return {
    name: "custom-docusaurus-webpack-config-plugin",
    configureWebpack(config, isServer, utils) {
      return {
        resolve: {
          fallback: {
            fs: isServer ? "fs" : false,
            dns: isServer ? "dns" : false,
            net: isServer ? "net" : false,
            tls: isServer ? "tls" : false,
            url: isServer ? "node:url" : "url",
          },
        },
        plugins: [
          new webpack.DefinePlugin({
            "process.versions.node": JSON.stringify(
              process.versions.node || "0.0.0"
            ),
          }),
          new NodePolyfillPlugin(),
        ],
      };
    },
  };
};

However, I have not been able to solve the last error:

Attempted import error: 'fileURLToPath' is not exported from 'url' (imported as 'fileURLToPath').
error Command failed with exit code 1.

Steps to reproduce:

  1. Download tinasaurus project
  2. Configure it with the setup given above
  3. run yarn build

Do you guys have any idea? Please, let me know if you need more info. Thanks

@ghost
Copy link

ghost commented Feb 23, 2024

Hello, I'm currently working on a similar project and I was wondering if you managed to resolve your problem?

@juliolugo96
Copy link
Author

At the end of the day, I decided to use Gitbook, which basically solved my problem. Great platform, tho: gitbook.com

@ghost
Copy link

ghost commented Feb 27, 2024

Gitbook has been quite helpful; I've adapted some of its features to demonstrate to the development team the specific CMS functionalities I'm interested in. My project involves creating a Strapi CMS integrated with Docusaurus on Next.js 14, designed to offer a no-code editing experience for the content management team. The idea of leveraging Docusaurus to facilitate a no-code user experience is particularly exciting to me.

The project is slated for completion by April 2024. Should anyone be in search of such a sophisticated solution, please feel free to reach out to me either on GitHub or through my provided link.

@bradystroud
Copy link
Member

The start has just been upgraded to Docusaurus 3 in #15

Does this fix the issues?

@ghost
Copy link

ghost commented May 30, 2024 via email

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