diff --git a/docs/09-troubleshooting.md b/docs/09-troubleshooting.md index d528385200..821f4c637d 100644 --- a/docs/09-troubleshooting.md +++ b/docs/09-troubleshooting.md @@ -9,7 +9,7 @@ Some packages are written with dependencies on Node.js built-in modules. This is a problem on the web, since Node.js built-in modules don't exist in the browser. For example, `import 'path'` will run just fine in Node.js but would fail in the browser. -To solve this issue, you can either replace the offending package ([pika.dev](https://pika.dev/) is a great resource for web-friendly packages) or add Node.js polyfill support: +**To solve this issue:** you can either replace the offending package ([pika.dev](https://pika.dev/) is a great resource for web-friendly packages) or add Node.js polyfill support: ```js // snowpack.config.js diff --git a/src/commands/install.ts b/src/commands/install.ts index d399f3e694..6778cf6042 100644 --- a/src/commands/install.ts +++ b/src/commands/install.ts @@ -160,7 +160,7 @@ function resolveWebDependency(dep: string): DependencyLoc { // Oh well, was worth a try } } - if (!depManifest) { + if (!depManifestLoc || !depManifest) { throw new ErrorWithHint( `Package "${dep}" not found. Have you installed it?`, depManifestLoc ? chalk.italic(depManifestLoc) : '', @@ -199,7 +199,7 @@ function resolveWebDependency(dep: string): DependencyLoc { } return { type: 'JS', - loc: path.join(depManifestLoc || '', '..', foundEntrypoint), + loc: require.resolve(path.join(depManifestLoc || '', '..', foundEntrypoint)), }; } @@ -279,9 +279,6 @@ export async function install( try { const {type: targetType, loc: targetLoc} = resolveWebDependency(installSpecifier); if (targetType === 'JS') { - if (isSinglePackageMode && !checkIsEsModule(targetLoc)) { - autoDetectNamedExports.push(installSpecifier); - } installEntrypoints[targetName] = targetLoc; importMap.imports[installSpecifier] = `./${targetName}.js`; Object.entries(installAlias) diff --git a/src/rollup-plugin-catch-unresolved.ts b/src/rollup-plugin-catch-unresolved.ts index e3726ea70c..1668238ec0 100644 --- a/src/rollup-plugin-catch-unresolved.ts +++ b/src/rollup-plugin-catch-unresolved.ts @@ -19,7 +19,7 @@ export function rollupPluginCatchUnresolved(): Plugin { } else { this.warn({ id: importer, - message: `"${id}" could not be resolved.`, + message: `"${id}" could not be resolved. (Is it installed?)`, }); } return false;