How to use the @lwc/errors.ModuleResolutionErrors.MODULE_RESOLUTION_ERROR function in @lwc/errors

To help you get started, we’ve selected a few @lwc/errors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github salesforce / lwc / packages / @lwc / compiler / src / bundler / bundler.ts View on Github external
if (output.length > 1) {
            diagnostics.push(
                generateCompilerDiagnostic(ModuleResolutionErrors.RELATIVE_DYNAMIC_IMPORT)
            );
        }

        const result = output[0];
        code = result.code;
        map = result.map;
    } catch (e) {
        // Rollup may have clobbered error.code with its own data
        if (e instanceof CompilerError && (e as any).pluginCode) {
            e.code = (e as any).pluginCode;
        }

        const diagnostic = normalizeToDiagnostic(ModuleResolutionErrors.MODULE_RESOLUTION_ERROR, e);
        diagnostic.level = DiagnosticLevel.Fatal;
        diagnostics.push(diagnostic);
    }

    return {
        diagnostics,
        code,
        map,
    };
}
github salesforce / lwc / packages / @lwc / compiler / src / bundler / bundler.ts View on Github external
if (warning.loc) {
                const { loc, pos } = warning;
                origin = {
                    filename: loc.file,
                    location: {
                        line: loc.line,
                        column: loc.column,
                        start: pos,
                        length: 0,
                    },
                };
            }
        }

        diagnostics.push(
            generateCompilerDiagnostic(ModuleResolutionErrors.MODULE_RESOLUTION_ERROR, {
                messageArgs: [message],
                origin,
            })
        );
    };
}