martpie / next-transpile-modules

Next.js plugin to transpile code from node_modules. Please see: https://github.com/martpie/next-transpile-modules/issues/291
MIT License
1.13k stars 85 forks source link

Build failed: nextGlobalCssLoader.include will be null if experimental.appDir is true in nextjs 12.3.1 #278

Closed ssehacker closed 1 year ago

ssehacker commented 1 year ago

https://github.com/martpie/next-transpile-modules/blob/05437e6467893538c5f527555c65c686e411603d/src/next-transpile-modules.js#L225

ssehacker commented 1 year ago

https://github.com/vercel/next.js/blob/980095d59e0f108019415641a724910cd41a7630/packages/next/build/webpack/config/blocks/css/index.ts#L367

 if (ctx.experimental.appDir) {
      fns.push(
        loader({
          oneOf: [
            markRemovable({
              // A global CSS import always has side effects. Webpack will tree
              // shake the CSS without this option if the issuer claims to have
              // no side-effects.
              // See https://github.com/webpack/webpack/issues/6571
              sideEffects: true,
              test: regexCssGlobal,
              use: [
                require.resolve('../../../loaders/next-flight-css-dev-loader'),
                ...getGlobalCssLoader(ctx, lazyPostCSSInitializer),
              ],
            }),
          ],
        })
      )