Lines Matching refs:main

36 const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
120 * the package.json file does not define a "main" or "exports" field.
124 * @param {string} [main] - The "main" field from the package.json file.
126 function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
132 if (!main) {
134 `No "main" or "exports" field defined in the package.json for ${pkgPath
135 } resolving the main entry point "${
137 }.\nDefault "index" lookups for the main are deprecated for ES modules.`,
141 } else if (resolve(pkgPath, main) !== path) {
143 `Package ${pkgPath} has a "main" field set to "${main}", ` +
146 basePath}.\n Automatic extension resolution of the "main" field is ` +
165 * Legacy CommonJS main resolution:
166 * 1. let M = pkg_url + (json main field)
178 if (packageConfig.main !== undefined) {
180 if (fileExists(guess = new URL(`./${packageConfig.main}`, packageJSONUrl))) {
182 } else if (fileExists(guess = new URL(`./${packageConfig.main}.js`, packageJSONUrl))) {
184 } else if (fileExists(guess = new URL(`./${packageConfig.main}.json`, packageJSONUrl))) {
186 } else if (fileExists(guess = new URL(`./${packageConfig.main}.node`, packageJSONUrl))) {
188 } else if (fileExists(guess = new URL(`./${packageConfig.main}/index.js`, packageJSONUrl))) {
190 } else if (fileExists(guess = new URL(`./${packageConfig.main}/index.json`, packageJSONUrl))) {
192 } else if (fileExists(guess = new URL(`./${packageConfig.main}/index.node`, packageJSONUrl))) {
199 packageConfig.main);
214 emitLegacyIndexDeprecation(guess, packageJSONUrl, base, packageConfig.main);
256 const { main } = pkgJson;
257 if (main != null) {
258 const mainUrl = pathToFileURL(resolve(dirPath, main));
624 ' or an object of main entry condition name keys only.');