tinasaurus icon indicating copy to clipboard operation
tinasaurus copied to clipboard

Docusaurus 3.0 + TinaCMS 1.5.28 not working

Open juliolugo96 opened this issue 2 years ago • 5 comments

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

juliolugo96 avatar Jan 15 '24 06:01 juliolugo96

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

ghost avatar Feb 23 '24 09:02 ghost

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

juliolugo96 avatar Feb 26 '24 00:02 juliolugo96

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.

ghost avatar Feb 27 '24 06:02 ghost

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

Does this fix the issues?

bradystroud avatar May 30 '24 04:05 bradystroud

I have a custom dev hosted on Cloudflare with docusaurus and Decap CMS that works fine. It's a little bit sensitive if you go out of the preset, so you need to know what you are doing

On Thursday, May 30, 2024 at 6:33 AM, Brady Stroud [SSW] - notifications(a)github.com @.***> wrote:

 The start has just been upgraded to Docusaurus 3 in #15  [https://github.com/tinacms/tinasaurus/pull/15]    Does this fix the issues?    —  Reply to this email directly, view it on GitHub  [https://github.com/tinacms/tinasaurus/issues/13#issuecomment-2138659306],  or unsubscribe  [https://github.com/notifications/unsubscribe-auth/AYXMHJOF533EMBWKOSXMXKTZE2T2BAVCNFSM6AAAAABB2XWETWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZYGY2TSMZQGY].  You are receiving this because you commented.Message ID: @.***>

ghost avatar May 30 '24 07:05 ghost