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

Not compatible with alpha 75 / Webpack 5 #52

Closed
slorber opened this issue May 1, 2021 · 10 comments
Closed

Not compatible with alpha 75 / Webpack 5 #52

slorber opened this issue May 1, 2021 · 10 comments
Assignees

Comments

@slorber
Copy link

slorber commented May 1, 2021

Hi, Docusaurus maintainer here

I'm testing the latest alpha 75 release (Webpack 5) on a few sites, and this one is failing to upgrade due to this plugin: nextauthjs/next-auth#1826

Error: Conflict: Multiple chunks emit assets to the same filename server.bundle.js (chunks 179 and 462)
    at /Users/sebastienlorber/Desktop/projects/next-auth/www/node_modules/webpack/lib/Compilation.js:3864:12
    at /Users/sebastienlorber/Desktop/projects/next-auth/www/node_modules/webpack/lib/Cache.js:85:6
    at /Users/sebastienlorber/Desktop/projects/next-auth/www/node_modules/webpack/lib/Cache.js:39:11
    at /Users/sebastienlorber/Desktop/projects/next-auth/www/node_modules/webpack/lib/cache/IdleFileCachePlugin.js:66:9
    at /Users/sebastienlorber/Desktop/projects/next-auth/www/node_modules/webpack/lib/Cache.js:88:6
    at eval (eval at create (/Users/sebastienlorber/Desktop/projects/next-auth/www/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:1)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

You have webpack optimizations here:

    configureWebpack(config) {
      const generatedFilesDir = config.resolve.alias['@generated']
      languages = utils.generateLunrClientJS(generatedFilesDir, options.languages);
      // Ensure that algolia docsearch css is its own chunk
      return {
        optimization: {
          splitChunks: {
            cacheGroups: {
              algolia: {
                name: 'algolia',
                test: /algolia\.css$/,
                chunks: `all`,
                enforce: true,
                // Set priority higher than docusaurus single-css extraction
                priority: 60,
              },
            },
          },
        },
      };
    },

Removing these optimizations makes the plugin work again on alpha 75, so I suggest to remove those for now to ensure everybody can upgrade.

Not sure why this does not work anymore though, nor why we have this error message.

Was also wondering why you need this optimization, as the algolia code/plugin is already in a distinct package. Maybe it's a legacy optim?

Unrelated: the call to generateLunrClientJS would probably be better in another lifecycle like contentLoaded() (but in practice it is probably not very important).

@Chris-ganta
Copy link

Chris-ganta commented May 4, 2021

Hi @slorber I've removed the configureWebpack from the index.js file, and have run the npm run build. However, I'm still getting the same issue.

I've updgraded my Docusaurus version to 2.0.0-alpha.75.

Removed/Commented:

// configureWebpack(config) {
  //   const generatedFilesDir = config.resolve.alias['@generated']
  //   languages = utils.generateLunrClientJS(generatedFilesDir, options.languages);
  //   // Ensure that algolia docsearch css is its own chunk
  //   return {
  //     optimization: {
  //       splitChunks: {
  //         cacheGroups: {
  //           algolia: {
  //             name: 'algolia',
  //             test: /algolia\.css$/,
  //             chunks: `all`,
  //             enforce: true,
  //             // Set priority higher than docusaurus single-css extraction
  //             priority: 60,
  //           },
  //         },
  //       },
  //     },
  //   };
  // },

After I run npm run build:

Error: Conflict: Multiple chunks emit assets to the same filename server.bundle.js (chunks 179 and 462)
#12 75.29     at /app/website/node_modules/webpack/lib/Compilation.js:3864:12
#12 75.29     at /app/website/node_modules/webpack/lib/Cache.js:85:6
#12 75.29     at /app/website/node_modules/webpack/lib/Cache.js:39:11
#12 75.29     at /app/website/node_modules/webpack/lib/cache/IdleFileCachePlugin.js:66:9
#12 75.29     at /app/website/node_modules/webpack/lib/Cache.js:88:6
#12 75.29     at eval (eval at create (/app/website/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:1)
#12 75.29     at runMicrotasks (<anonymous>)
#12 75.29     at processTicksAndRejections (internal/process/task_queues.js:93:5)
#12 75.41 error building locale=en
#12 75.41 Error: Conflict: Multiple chunks emit assets to the same filename server.bundle.js (chunks 179 and 462)
#12 75.41     at /app/website/node_modules/webpack/lib/Compilation.js:3864:12
#12 75.41     at /app/website/node_modules/webpack/lib/Cache.js:85:6
#12 75.41     at /app/website/node_modules/webpack/lib/Cache.js:39:11
#12 75.41     at /app/website/node_modules/webpack/lib/cache/IdleFileCachePlugin.js:66:9
#12 75.41     at /app/website/node_modules/webpack/lib/Cache.js:88:6
#12 75.41     at eval (eval at create (/app/website/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:1)
#12 75.41     at runMicrotasks (<anonymous>)
#12 75.41     at processTicksAndRejections (internal/process/task_queues.js:93:5)
#12 83.87 error Command failed with exit code 1.
#12 83.87 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Is there anything that I need to do. Please advice.

@slorber
Copy link
Author

slorber commented May 4, 2021 via email

@Chris-ganta
Copy link

Chris-ganta commented May 4, 2021

@slorber

Thanks so much in replying back.

Wish I could provide you the repo. It's an internal repo and secured. To give you a background, it worked before the upgrade, and our Doc CI has been failing after the upgrade.
Any checks you recommend?

@slorber
Copy link
Author

slorber commented May 4, 2021 via email

@Chris-ganta
Copy link

Chris-ganta commented May 4, 2021

@slorber

I'm redoing the package from the beginning:

Updating the package.json:

    "dependencies": {
        "@docusaurus/core": "^2.0.0-alpha.75",
        "@docusaurus/preset-classic": "^2.0.0-alpha.75",

After I run npm install

code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: webpack@5.36.2
npm ERR! node_modules/webpack
npm ERR!   webpack@"^5.28.0" from @docusaurus/core@2.0.0-alpha.75
npm ERR!   node_modules/@docusaurus/core
npm ERR!     @docusaurus/core@"^2.0.0-alpha.75" from the root project
npm ERR!     @docusaurus/core@"2.0.0-alpha.75" from @docusaurus/preset-classic@2.0.0-alpha.75
npm ERR!     node_modules/@docusaurus/preset-classic
npm ERR!       @docusaurus/preset-classic@"^2.0.0-alpha.75" from the root project
npm ERR!     11 more (@docusaurus/plugin-content-blog, ...)
npm ERR!   webpack@"^5.28.0" from @docusaurus/types@2.0.0-alpha.75
npm ERR!   node_modules/@docusaurus/types
npm ERR!     @docusaurus/types@"2.0.0-alpha.75" from @docusaurus/core@2.0.0-alpha.75
npm ERR!     node_modules/@docusaurus/core
npm ERR!       @docusaurus/core@"^2.0.0-alpha.75" from the root project
npm ERR!       12 more (@docusaurus/preset-classic, ...)
npm ERR!     @docusaurus/types@"2.0.0-alpha.75" from @docusaurus/utils@2.0.0-alpha.75
npm ERR!     node_modules/@docusaurus/utils
npm ERR!       @docusaurus/utils@"2.0.0-alpha.75" from @docusaurus/core@2.0.0-alpha.75
npm ERR!       node_modules/@docusaurus/core
npm ERR!         @docusaurus/core@"^2.0.0-alpha.75" from the root project
npm ERR!         12 more (@docusaurus/preset-classic, ...)
npm ERR!       9 more (@docusaurus/utils-validation, ...)
npm ERR!     7 more (@docusaurus/plugin-content-blog, ...)
npm ERR!   17 more (babel-loader, copy-webpack-plugin, css-loader, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from webpack-dev-middleware@3.7.2
npm ERR! node_modules/webpack-dev-server/node_modules/webpack-dev-middleware
npm ERR!   webpack-dev-middleware@"^3.7.2" from webpack-dev-server@3.11.2
npm ERR!   node_modules/webpack-dev-server
npm ERR!     webpack-dev-server@"^3.11.2" from @docusaurus/core@2.0.0-alpha.75
npm ERR!     node_modules/@docusaurus/core
npm ERR!       @docusaurus/core@"^2.0.0-alpha.75" from the root project
npm ERR!       12 more (@docusaurus/preset-classic, ...)
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/user1/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user1/.npm/_logs/2021-05-04T08_16_52_306Z-debug.log

@slorber
Copy link
Author

slorber commented May 4, 2021

@Chris-ganta I'm sorry but I can only help if you provide a repro. If your repo is private, remove the sensitive parts and publish the reduced repro publicly, or give me access to your private repo and tell me which branch fails to build.

xf- added a commit to xf-/docusaurus-lunr-search that referenced this issue May 4, 2021
@xf-
Copy link
Contributor

xf- commented May 4, 2021

@slorber best option for no is a fork and replace it in package or?

Did that and it works, but is not that nice.

Sadly this project is not really well maintained and others search integrations (except SaaS solution) are really basic.

@slorber
Copy link
Author

slorber commented May 4, 2021

A temporary workaround is to publish your own fork, or use something like patch-package to fix it locally

@lelouch77
Copy link
Collaborator

new veriosn v2.1.13 published with the fix

@slorber
Copy link
Author

slorber commented May 11, 2021

thanks 👍

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

Successfully merging a pull request may close this issue.

4 participants