Skip to content

Commit

Permalink
Merge pull request #21834 from storybookjs/valentin/fix-loader-resolu…
Browse files Browse the repository at this point in the history
…tion-in-nextjs

Add explicit require.resolve calls to nextjs webpack loader config
  • Loading branch information
valentinpalkovic authored Mar 30, 2023
2 parents 6028541 + 5fce013 commit 41ff404
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions code/frameworks/nextjs/src/css/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export const configureCss = (baseConfig: WebpackConfig, nextConfig: NextConfig):
rules[i] = {
test: /\.css$/,
use: [
'style-loader',
require.resolve('style-loader'),
{
loader: 'css-loader',
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
...getImportAndUrlCssLoaderOptions(nextConfig),
Expand All @@ -27,27 +27,27 @@ export const configureCss = (baseConfig: WebpackConfig, nextConfig: NextConfig):
},
},
},
'postcss-loader',
require.resolve('postcss-loader'),
],
};
}
});
rules?.push({
test: /\.(scss|sass)$/,
use: [
'style-loader',
require.resolve('style-loader'),
{
loader: 'css-loader',
loader: require.resolve('css-loader'),
options: {
importLoaders: 3,
...getImportAndUrlCssLoaderOptions(nextConfig),
modules: { auto: true, getLocalIdent: getCssModuleLocalIdent },
},
},
'postcss-loader',
'resolve-url-loader',
require.resolve('postcss-loader'),
require.resolve('resolve-url-loader'),
{
loader: 'sass-loader',
loader: require.resolve('sass-loader'),
options: {
sourceMap: true,
sassOptions: nextConfig.sassOptions,
Expand Down

0 comments on commit 41ff404

Please sign in to comment.