Skip to content

Commit

Permalink
Merge pull request #786 from cprussin/main
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpl committed Mar 28, 2023
2 parents 38a6815 + b7a0428 commit ce980c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/special/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function parseWebpackConfig(webpackConfig, deps) {
return [...webpack1Loaders, ...webpack2Loaders, ...webpackEntries];
}

function loadNextWebpackConfig(filepath) {
async function loadNextWebpackConfig(filepath) {
const fakeConfig = {
plugins: [],
module: { rules: [] },
Expand All @@ -163,7 +163,7 @@ function loadNextWebpackConfig(filepath) {
const fakeContext = { webpack: fakeWebpack, defaultLoaders: {} };

try {
const nextConfig = require(filepath); // eslint-disable-line global-require
const nextConfig = await import(filepath);
if (nextConfig && nextConfig.webpack) {
return nextConfig.webpack(fakeConfig, fakeContext);
}
Expand All @@ -179,7 +179,7 @@ function loadNextWebpackConfig(filepath) {
return null;
}

export default function parseWebpack(filename, deps) {
export default async function parseWebpack(filename, deps) {
const basename = path.basename(filename);

if (webpackConfigRegex.test(basename)) {
Expand All @@ -197,7 +197,7 @@ export default function parseWebpack(filename, deps) {
}

if (basename === 'next.config.js') {
const webpackConfig = loadNextWebpackConfig(filename);
const webpackConfig = await loadNextWebpackConfig(filename);
if (webpackConfig) {
return parseWebpackConfig(webpackConfig, deps);
}
Expand Down

0 comments on commit ce980c1

Please sign in to comment.