Skip to content

Commit

Permalink
Merge branch 'master' into next-13
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre de la Martiniere committed Nov 1, 2022
2 parents b224849 + 33bab49 commit 7762da2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/next-transpile-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@ const withTmInitializer = (modules = [], options = {}) => {
);

if (nextGlobalCssLoader) {
nextGlobalCssLoader.issuer = { or: [matcher, nextGlobalCssLoader.issuer] };
nextGlobalCssLoader.include = { or: [...modulesPaths, nextGlobalCssLoader.include] };
nextGlobalCssLoader.issuer = {
or: nextGlobalCssLoader.issuer ? [matcher, nextGlobalCssLoader.issuer] : [matcher],
};
nextGlobalCssLoader.include = {
or: nextGlobalCssLoader.include ? [...modulesPaths, nextGlobalCssLoader.include] : modulesPaths,
};
} else if (!options.isServer) {
// Note that Next.js ignores global CSS imports on the server
console.warn('next-transpile-modules - could not find default CSS rule, global CSS imports may not work');
Expand All @@ -218,7 +222,9 @@ const withTmInitializer = (modules = [], options = {}) => {
// FIXME: SASS works only when using a custom _app.js file.
// See https://github.com/vercel/next.js/blob/24c3929ec46edfef8fb7462a17edc767a90b5d2b/packages/next/build/webpack/config/blocks/css/index.ts#L211
if (nextGlobalSassLoader) {
nextGlobalSassLoader.issuer = { or: [matcher, nextGlobalSassLoader.issuer] };
nextGlobalSassLoader.issuer = {
or: nextGlobalSassLoader.issuer ? [matcher, nextGlobalSassLoader.issuer] : [matcher],
};
} else if (!options.isServer) {
// Note that Next.js ignores global SASS imports on the server
console.info('next-transpile-modules - global SASS imports only work with a custom _app.js file');
Expand Down

0 comments on commit 7762da2

Please sign in to comment.