diff --git a/packages/next/build/plugins/collect-plugins.ts b/packages/next/build/plugins/collect-plugins.ts index c23e876359c0edb..bb5c5e33c96a72d 100644 --- a/packages/next/build/plugins/collect-plugins.ts +++ b/packages/next/build/plugins/collect-plugins.ts @@ -1,7 +1,6 @@ import findUp from 'next/dist/compiled/find-up' import { promises } from 'fs' import path from 'path' -import resolve from 'next/dist/compiled/resolve/index.js' import { execOnce } from '../../next-server/lib/utils' const { version } = require('next/package.json') @@ -213,10 +212,7 @@ async function _collectPlugins( nextPluginNames.map((name) => collectPluginMeta( env, - resolve.sync(path.join(name, 'package.json'), { - basedir: dir, - preserveSymlinks: true, - }), + require.resolve(path.join(name, 'package.json'), { paths: [dir] }), name, version ) diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index 94f49a1b1cc851b..1172ad7067e8ecf 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -18,7 +18,6 @@ import { import { fileExists } from '../lib/file-exists' import { getPackageVersion } from '../lib/get-package-version' import { Rewrite } from '../lib/load-custom-routes' -import { resolveRequest } from '../lib/resolve-request' import { getTypeScriptConfiguration } from '../lib/typescript/getTypeScriptConfiguration' import { CLIENT_STATIC_FILES_RUNTIME_MAIN, @@ -308,7 +307,7 @@ export default async function getBaseWebpackConfig( let typeScriptPath: string | undefined try { - typeScriptPath = resolveRequest('typescript', `${dir}/`) + typeScriptPath = require.resolve('typescript', { paths: [dir] }) } catch (_) {} const tsConfigPath = path.join(dir, 'tsconfig.json') const useTypeScript = Boolean( @@ -609,7 +608,7 @@ export default async function getBaseWebpackConfig( // exist. let res: string try { - res = resolveRequest(request, `${context}/`) + res = require.resolve(request, { paths: [context] }) } catch (err) { // If the request cannot be resolved, we need to tell webpack to // "bundle" it so that webpack shows an error (that it cannot be @@ -647,7 +646,7 @@ export default async function getBaseWebpackConfig( // we need to bundle the code (even if it _should_ be external). let baseRes: string | null try { - baseRes = resolveRequest(request, `${dir}/`) + baseRes = require.resolve(request, { paths: [dir] }) } catch (err) { baseRes = null } @@ -1426,29 +1425,32 @@ export default async function getBaseWebpackConfig( try { // Resolve the version of `@zeit/next-css` as depended on by the Sass, // Less or Stylus plugin. - const correctNextCss = resolveRequest( - '@zeit/next-css', - isCss - ? // Resolve `@zeit/next-css` from the base directory - `${dir}/` - : // Else, resolve it from the specific plugins - require.resolve( - isSass - ? '@zeit/next-sass' - : isLess - ? '@zeit/next-less' - : isStylus - ? '@zeit/next-stylus' - : 'next' - ) - ) + const correctNextCss = require.resolve('@zeit/next-css', { + paths: [ + isCss + ? // Resolve `@zeit/next-css` from the base directory + dir + : // Else, resolve it from the specific plugins + require.resolve( + isSass + ? '@zeit/next-sass' + : isLess + ? '@zeit/next-less' + : isStylus + ? '@zeit/next-stylus' + : 'next' + ), + ], + }) // If we found `@zeit/next-css` ... if (correctNextCss) { // ... resolve the version of `css-loader` shipped with that // package instead of whichever was hoisted highest in your // `node_modules` tree. - const correctCssLoader = resolveRequest(use.loader, correctNextCss) + const correctCssLoader = require.resolve(use.loader, { + paths: [correctNextCss], + }) if (correctCssLoader) { // We saved the user from a failed build! use.loader = correctCssLoader diff --git a/packages/next/build/webpack/config/blocks/css/plugins.ts b/packages/next/build/webpack/config/blocks/css/plugins.ts index c1fd7aba2dc7898..7aa6d22e41d9575 100644 --- a/packages/next/build/webpack/config/blocks/css/plugins.ts +++ b/packages/next/build/webpack/config/blocks/css/plugins.ts @@ -1,6 +1,5 @@ import chalk from 'chalk' import { findConfig } from '../../../../../lib/find-config' -import { resolveRequest } from '../../../../../lib/resolve-request' import browserslist from 'browserslist' type CssPluginCollection_Array = (string | [string, boolean | object])[] @@ -57,7 +56,7 @@ async function loadPlugin( throw new Error(genericErrorText) } - const pluginPath = resolveRequest(pluginName, `${dir}/`) + const pluginPath = require.resolve(pluginName, { paths: [dir] }) if (isIgnoredPlugin(pluginPath)) { return false } else if (options === true) { diff --git a/packages/next/compiled/resolve/LICENSE b/packages/next/compiled/resolve/LICENSE deleted file mode 100644 index ee27ba4b4412b0e..000000000000000 --- a/packages/next/compiled/resolve/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/next/compiled/resolve/index.js b/packages/next/compiled/resolve/index.js deleted file mode 100644 index e0e41629c41a2f7..000000000000000 --- a/packages/next/compiled/resolve/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports=(()=>{var e={731:e=>{"use strict";var r=process.platform==="win32";var n=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var t=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;var i={};function win32SplitPath(e){var r=n.exec(e),i=(r[1]||"")+(r[2]||""),a=r[3]||"";var o=t.exec(a),s=o[1],l=o[2],u=o[3];return[i,s,l,u]}i.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var r=win32SplitPath(e);if(!r||r.length!==4){throw new TypeError("Invalid path '"+e+"'")}return{root:r[0],dir:r[0]+r[1].slice(0,-1),base:r[2],ext:r[3],name:r[2].slice(0,r[2].length-r[3].length)}};var a=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var o={};function posixSplitPath(e){return a.exec(e).slice(1)}o.parse=function(e){if(typeof e!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e)}var r=posixSplitPath(e);if(!r||r.length!==4){throw new TypeError("Invalid path '"+e+"'")}r[1]=r[1]||"";r[2]=r[2]||"";r[3]=r[3]||"";return{root:r[0],dir:r[0]+r[1].slice(0,-1),base:r[2],ext:r[3],name:r[2].slice(0,r[2].length-r[3].length)}};if(r)e.exports=i.parse;else e.exports=o.parse;e.exports.posix=o.parse;e.exports.win32=i.parse},283:(e,r,n)=>{var t=n(226);var i=n(125);i.core=t;i.isCore=function isCore(e){return t[e]};i.sync=n(284);r=i;e.exports=i},125:(e,r,n)=>{var t=n(226);var i=n(747);var a=n(622);var o=n(155);var s=n(433);var l=n(990);var u=function isFile(e,r){i.stat(e,function(e,n){if(!e){return r(null,n.isFile()||n.isFIFO())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return r(null,false);return r(e)})};var f=function isDirectory(e,r){i.stat(e,function(e,n){if(!e){return r(null,n.isDirectory())}if(e.code==="ENOENT"||e.code==="ENOTDIR")return r(null,false);return r(e)})};e.exports=function resolve(e,r,n){var c=n;var p=r;if(typeof r==="function"){c=p;p={}}if(typeof e!=="string"){var v=new TypeError("Path must be a string.");return process.nextTick(function(){c(v)})}p=l(e,p);var d=p.isFile||u;var y=p.isDirectory||f;var _=p.readFile||i.readFile;var g=p.extensions||[".js"];var m=p.basedir||a.dirname(o());var h=p.filename||m;p.paths=p.paths||[];var F=a.resolve(m);if(p.preserveSymlinks===false){i.realpath(F,function(e,r){if(e&&e.code!=="ENOENT")c(v);else init(e?F:r)})}else{init(F)}var w;function init(r){if(/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(e)){w=a.resolve(r,e);if(e===".."||e.slice(-1)==="/")w+="/";if(/\/$/.test(e)&&w===r){loadAsDirectory(w,p.package,onfile)}else loadAsFile(w,p.package,onfile)}else loadNodeModules(e,r,function(r,n,i){if(r)c(r);else if(n)c(null,n,i);else if(t[e])return c(null,e);else{var a=new Error("Cannot find module '"+e+"' from '"+h+"'");a.code="MODULE_NOT_FOUND";c(a)}})}function onfile(r,n,t){if(r)c(r);else if(n)c(null,n,t);else loadAsDirectory(w,function(r,n,t){if(r)c(r);else if(n)c(null,n,t);else{var i=new Error("Cannot find module '"+e+"' from '"+h+"'");i.code="MODULE_NOT_FOUND";c(i)}})}function loadAsFile(e,r,n){var t=r;var i=n;if(typeof t==="function"){i=t;t=undefined}var o=[""].concat(g);load(o,e,t);function load(e,r,n){if(e.length===0)return i(null,undefined,n);var t=r+e[0];var o=n;if(o)onpkg(null,o);else loadpkg(a.dirname(t),onpkg);function onpkg(n,s,l){o=s;if(n)return i(n);if(l&&o&&p.pathFilter){var u=a.relative(l,t);var f=u.slice(0,u.length-e[0].length);var c=p.pathFilter(o,r,f);if(c)return load([""].concat(g.slice()),a.resolve(l,c),o)}d(t,onex)}function onex(n,a){if(n)return i(n);if(a)return i(null,t,o);load(e.slice(1),r,o)}}}function loadpkg(e,r){if(e===""||e==="/")return r(null);if(process.platform==="win32"&&/^\w:[/\\]*$/.test(e)){return r(null)}if(/[/\\]node_modules[/\\]*$/.test(e))return r(null);var n=a.join(e,"package.json");d(n,function(t,i){if(!i)return loadpkg(a.dirname(e),r);_(n,function(t,i){if(t)r(t);try{var a=JSON.parse(i)}catch(e){}if(a&&p.packageFilter){a=p.packageFilter(a,n)}r(null,a,e)})})}function loadAsDirectory(e,r,n){var t=n;var i=r;if(typeof i==="function"){t=i;i=p.package}var o=a.join(e,"package.json");d(o,function(r,n){if(r)return t(r);if(!n)return loadAsFile(a.join(e,"index"),i,t);_(o,function(r,n){if(r)return t(r);try{var i=JSON.parse(n)}catch(e){}if(p.packageFilter){i=p.packageFilter(i,o)}if(i.main){if(typeof i.main!=="string"){var s=new TypeError("package “"+i.name+"” `main` must be a string");s.code="INVALID_PACKAGE_MAIN";return t(s)}if(i.main==="."||i.main==="./"){i.main="index"}loadAsFile(a.resolve(e,i.main),i,function(r,n,i){if(r)return t(r);if(n)return t(null,n,i);if(!i)return loadAsFile(a.join(e,"index"),i,t);var o=a.resolve(e,i.main);loadAsDirectory(o,i,function(r,n,i){if(r)return t(r);if(n)return t(null,n,i);loadAsFile(a.join(e,"index"),i,t)})});return}loadAsFile(a.join(e,"/index"),i,t)})})}function processDirs(r,n){if(n.length===0)return r(null,undefined);var t=n[0];y(t,isdir);function isdir(i,o){if(i)return r(i);if(!o)return processDirs(r,n.slice(1));var s=a.join(t,e);loadAsFile(s,p.package,onfile)}function onfile(n,i,o){if(n)return r(n);if(i)return r(null,i,o);loadAsDirectory(a.join(t,e),p.package,ondir)}function ondir(e,t,i){if(e)return r(e);if(t)return r(null,t,i);processDirs(r,n.slice(1))}}function loadNodeModules(e,r,n){processDirs(n,s(r,p,e))}}},155:e=>{e.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,r){return r};var r=(new Error).stack;Error.prepareStackTrace=e;return r[2].getFileName()}},226:(e,r,n)=>{var t=process.versions&&process.versions.node&&process.versions.node.split(".")||[];function specifierIncluded(e){var r=e.split(" ");var n=r.length>1?r[0]:"=";var i=(r.length>1?r[1]:r[0]).split(".");for(var a=0;a<3;++a){var o=Number(t[a]||0);var s=Number(i[a]||0);if(o===s){continue}if(n==="<"){return o="){return o>=s}else{return false}}return n===">="}function matchesRange(e){var r=e.split(/ ?&& ?/);if(r.length===0){return false}for(var n=0;n{var t=n(622);var i=t.parse||n(731);var a=function getNodeModulesDirs(e,r){var n="/";if(/^([A-Za-z]:)/.test(e)){n=""}else if(/^\\\\/.test(e)){n="\\\\"}var a=[e];var o=i(e);while(o.dir!==a[a.length-1]){a.push(o.dir);o=i(o.dir)}return a.reduce(function(e,i){return e.concat(r.map(function(e){return t.join(n,i,e)}))},[])};e.exports=function nodeModulesPaths(e,r,n){var t=r&&r.moduleDirectory?[].concat(r.moduleDirectory):["node_modules"];if(r&&typeof r.paths==="function"){return r.paths(n,e,function(){return a(e,t)},r)}var i=a(e,t);return r&&r.paths?i.concat(r.paths):i}},990:e=>{e.exports=function(e,r){return r||{}}},284:(e,r,n)=>{var t=n(226);var i=n(747);var a=n(622);var o=n(155);var s=n(433);var l=n(990);var u=function isFile(e){try{var r=i.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return r.isFile()||r.isFIFO()};var f=function isDirectory(e){try{var r=i.statSync(e)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return false;throw e}return r.isDirectory()};e.exports=function(e,r){if(typeof e!=="string"){throw new TypeError("Path must be a string.")}var n=l(e,r);var c=n.isFile||u;var p=n.readFileSync||i.readFileSync;var v=n.isDirectory||f;var d=n.extensions||[".js"];var y=n.basedir||a.dirname(o());var _=n.filename||y;n.paths=n.paths||[];var g=a.resolve(y);if(n.preserveSymlinks===false){try{g=i.realpathSync(g)}catch(e){if(e.code!=="ENOENT"){throw e}}}if(/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(e)){var m=a.resolve(g,e);if(e===".."||e.slice(-1)==="/")m+="/";var h=loadAsFileSync(m)||loadAsDirectorySync(m);if(h)return h}else{var F=loadNodeModulesSync(e,g);if(F)return F}if(t[e])return e;var w=new Error("Cannot find module '"+e+"' from '"+_+"'");w.code="MODULE_NOT_FOUND";throw w;function loadAsFileSync(e){var r=loadpkg(a.dirname(e));if(r&&r.dir&&r.pkg&&n.pathFilter){var t=a.relative(r.dir,e);var i=n.pathFilter(r.pkg,e,t);if(i){e=a.resolve(r.dir,i)}}if(c(e)){return e}for(var o=0;o{"use strict";e.exports=JSON.parse('{"assert":true,"async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debugger":"< 8","dgram":true,"dns":true,"domain":true,"events":true,"freelist":"< 6","fs":true,"fs/promises":">= 10 && < 10.1","_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"string_decoder":true,"sys":true,"timers":true,"_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"worker_threads":">= 11.7","zlib":true}')},747:e=>{"use strict";e.exports=require("fs")},622:e=>{"use strict";e.exports=require("path")}};var r={};function __webpack_require__(n){if(r[n]){return r[n].exports}var t=r[n]={exports:{}};var i=true;try{e[n](t,t.exports,__webpack_require__);i=false}finally{if(i)delete r[n]}return t.exports}__webpack_require__.ab=__dirname+"/";return __webpack_require__(283)})(); \ No newline at end of file diff --git a/packages/next/compiled/resolve/package.json b/packages/next/compiled/resolve/package.json deleted file mode 100644 index 7b090b9743e5e71..000000000000000 --- a/packages/next/compiled/resolve/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"resolve","main":"index.js","author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT"} diff --git a/packages/next/lib/get-package-version.ts b/packages/next/lib/get-package-version.ts index 9e2fcbebf89692d..2b516a59dcf7acc 100644 --- a/packages/next/lib/get-package-version.ts +++ b/packages/next/lib/get-package-version.ts @@ -2,7 +2,6 @@ import { promises as fs } from 'fs' import findUp from 'next/dist/compiled/find-up' import JSON5 from 'next/dist/compiled/json5' import * as path from 'path' -import { resolveRequest } from './resolve-request' type PackageJsonDependencies = { dependencies: Record @@ -52,7 +51,9 @@ export async function getPackageVersion({ : `${cwd}/` try { - const targetPath = resolveRequest(`${name}/package.json`, cwd2) + const targetPath = require.resolve(`${name}/package.json`, { + paths: [cwd2], + }) const targetContent = await fs.readFile(targetPath, 'utf-8') return JSON5.parse(targetContent).version ?? null } catch { diff --git a/packages/next/lib/resolve-request.ts b/packages/next/lib/resolve-request.ts deleted file mode 100644 index e15f3d737bde060..000000000000000 --- a/packages/next/lib/resolve-request.ts +++ /dev/null @@ -1,18 +0,0 @@ -import resolve from 'next/dist/compiled/resolve/index.js' -import path from 'path' - -export function resolveRequest(req: string, issuer: string): string { - // The `resolve` package is prebuilt through ncc, which prevents - // PnP from being able to inject itself into it. To circumvent - // this, we simply use PnP directly when available. - if (process.versions.pnp) { - const { resolveRequest: pnpResolveRequest } = require(`pnpapi`) - return pnpResolveRequest(req, issuer, { considerBuiltins: false }) - } else { - const basedir = - issuer.endsWith(path.posix.sep) || issuer.endsWith(path.win32.sep) - ? issuer - : path.dirname(issuer) - return resolve.sync(req, { basedir }) - } -} diff --git a/packages/next/lib/typescript/hasNecessaryDependencies.ts b/packages/next/lib/typescript/hasNecessaryDependencies.ts index 6dac0650c074418..5e4996978470114 100644 --- a/packages/next/lib/typescript/hasNecessaryDependencies.ts +++ b/packages/next/lib/typescript/hasNecessaryDependencies.ts @@ -2,7 +2,6 @@ import chalk from 'chalk' import path from 'path' import { fileExists } from '../file-exists' import { getOxfordCommaList } from '../oxford-comma-list' -import { resolveRequest } from '../resolve-request' import { FatalTypeScriptError } from './FatalTypeScriptError' const requiredPackages = [ @@ -22,7 +21,7 @@ export async function hasNecessaryDependencies( const missingPackages = requiredPackages.filter((p) => { try { - resolutions.set(p.pkg, resolveRequest(p.file, path.join(baseDir, '/'))) + resolutions.set(p.pkg, require.resolve(p.file, { paths: [baseDir] })) return false } catch (_) { return true diff --git a/packages/next/package.json b/packages/next/package.json index 761abd06dbffada..c5d79017f16f9ad 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -172,7 +172,6 @@ "@types/react": "16.9.17", "@types/react-dom": "16.9.4", "@types/react-is": "16.7.1", - "@types/resolve": "0.0.8", "@types/semver": "7.3.1", "@types/send": "0.14.4", "@types/sharp": "0.26.0", @@ -220,7 +219,6 @@ "postcss-preset-env": "6.7.0", "postcss-scss": "3.0.4", "recast": "0.18.5", - "resolve": "1.11.0", "semver": "7.3.2", "send": "0.17.1", "source-map": "0.6.1", diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index 0712a9be2211de9..89b8d525ffb7526 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -404,16 +404,6 @@ export async function ncc_recast(task, opts) { .target('compiled/recast') } // eslint-disable-next-line camelcase -// NB: Used by other dependencies, but Vercel version is a duplicate -// version so can be inlined anyway (although may change in future) -externals['resolve'] = 'next/dist/compiled/resolve' -export async function ncc_resolve(task, opts) { - await task - .source(opts.src || relative(__dirname, require.resolve('resolve'))) - .ncc({ packageName: 'resolve', externals }) - .target('compiled/resolve') -} -// eslint-disable-next-line camelcase externals['schema-utils'] = 'next/dist/compiled/schema-utils' export async function ncc_schema_utils(task, opts) { await task @@ -576,7 +566,6 @@ export async function ncc(task) { 'ncc_postcss_preset_env', 'ncc_postcss_scss', 'ncc_recast', - 'ncc_resolve', 'ncc_schema_utils', 'ncc_send', 'ncc_source_map', diff --git a/packages/next/types/misc.d.ts b/packages/next/types/misc.d.ts index aa1832b69dadf95..afb31154d8125a6 100644 --- a/packages/next/types/misc.d.ts +++ b/packages/next/types/misc.d.ts @@ -145,10 +145,6 @@ declare module 'next/dist/compiled/recast' { import m from 'recast' export = m } -declare module 'next/dist/compiled/resolve/index.js' { - import m from 'resolve' - export = m -} declare module 'next/dist/compiled/send' { import m from 'send' export = m diff --git a/test-pnp.sh b/test-pnp.sh index 6ea70845a22b8fa..43564baf466a209 100644 --- a/test-pnp.sh +++ b/test-pnp.sh @@ -1,7 +1,10 @@ declare -a testCases=( "with-typescript" "with-next-sass" + # Tests @next/mdx "with-mdx" + # Tests babel config + "with-styled-components" ) set -e @@ -25,6 +28,7 @@ do touch yarn.lock yarn set version berry yarn config set pnpFallbackMode none + yarn config set enableGlobalCache true yarn link --all --private -r ../.. yarn build diff --git a/yarn.lock b/yarn.lock index 41600effcdf6d89..65c0b5969c2249c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2944,12 +2944,6 @@ "@types/prop-types" "*" csstype "^2.2.0" -"@types/resolve@0.0.8": - version "0.0.8" - resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" - dependencies: - "@types/node" "*" - "@types/resolve@1.17.1": version "1.17.1" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" @@ -13655,13 +13649,6 @@ resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@1.11.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232" - integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw== - dependencies: - path-parse "^1.0.6" - resolve@1.17.0: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444"