Skip to content

Commit

Permalink
fix: Yarn PnP throws a completely different message for _reasons_
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Feb 25, 2022
1 parent 16f2dea commit 96a14f7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/cli/lib/lib/webpack/transform-config.js
Expand Up @@ -102,16 +102,20 @@ module.exports = async function (env, webpackConfig, isServer = false) {
try {
m = esmImport(myConfig);
} catch (err) {
const notFound = err.message.includes('Cannot find module');
const notFound =
err.message.includes('Cannot find module') ||
err.message.includes('Qualified path resolution failed');
if (notFound && isDefault) return;
if (notFound) {
throw new Error(
`Failed to load preact-cli config!\nFile ${env.config} not found.\n`
);
}
throw new Error(`Failed to load preact-cli config!\n${
env.verbose ? err.stack : err.message
}\n`);
throw new Error(
`Failed to load preact-cli config!\n${
env.verbose ? err.stack : err.message
}\n`
);
}

const transformers = parseConfig((m && m.default) || m);
Expand Down

0 comments on commit 96a14f7

Please sign in to comment.