What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
If adding anew feature, the PR's description includes:
Other information:
Reasons:
The virtual module is wrappedhere, which addsthe wrapper:
(function(exports,require,module,__filename,__dirname){// Module code actually lives in here});
However,__filename
and__dirname
are not provided:
| compiledWrapper.call(m.exports,m.exports,r,m) |
When Webpack 5 builds for a Node.js target, it uses the following code. Because__filename
isundefined
,require("url").pathToFileURL(__filename)
breaks. Notice this is with bothoptimization.splitChunks
andoptimization.runtimeChunk
set tofalse
, and there are no chunks -- proven by theinstalledChunks
object below.
/******//* webpack/runtime/require chunk loading *//******/(()=>{/******/__webpack_require__.b=require("url").pathToFileURL(__filename);/******//******/// object to store loaded chunks/******/// "1" means "loaded", otherwise not loaded yet/******/varinstalledChunks={/******/"main":1/******/};/******//******/// no on chunks loaded/******//******/varinstallChunk=(chunk)=>{/******/varmoreModules=chunk.modules,chunkIds=chunk.ids,runtime=chunk.runtime;/******/for(varmoduleIdinmoreModules){/******/if(__webpack_require__.o(moreModules,moduleId)){/******/__webpack_require__.m[moduleId]=moreModules[moduleId];/******/}/******/}/******/if(runtime)runtime(__webpack_require__);/******/for(vari=0;i<chunkIds.length;i++)/******/installedChunks[chunkIds[i]]=1;/******//******/};/******//******/// require() chunk loading for javascript/******/__webpack_require__.f.require=(chunkId,promises)=>{/******/// "1" is the signal for "already loaded"/******/if(!installedChunks[chunkId]){/******/if(true){// all chunks have JS/******/installChunk(require("./"+__webpack_require__.u(chunkId)));/******/}elseinstalledChunks[chunkId]=1;/******/}/******/};/******//******/// no external install chunk/******//******/// no HMR/******//******/// no HMR manifest/******/})();/******/
The error message:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined at validateString (internal/validators.js:124:11) at Object.resolve (path.js:980:7) at Object.pathToFileURL (internal/url.js:1411:25) at main.js:45690:51 at main.js:45728:13 at Object.<anonymous> (main.js:45800:12) at evaluateModule (/vue-server-renderer/build.dev.js:9351:21) at /vue-server-renderer/build.dev.js:9409:18 at new Promise (<anonymous>) at /vue-server-renderer/build.dev.js:9401:14 at Object.renderToString (/vue-server-renderer/build.dev.js:9577:9) at /vue-just-ssr/lib/init-server.js:41:39 at call (/connect/index.js:239:7) at next (/connect/index.js:183:5) at middleware (/webpack-hot-middleware/middleware.js:38:48) at call (/connect/index.js:239:7) {code: 'ERR_INVALID_ARG_TYPE'}
Uh oh!
There was an error while loading.Please reload this page.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch),not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)If adding anew feature, the PR's description includes:
Other information:
Reasons:
The virtual module is wrappedhere, which addsthe wrapper:
However,
__filename
and__dirname
are not provided:vue/src/server/bundle-renderer/create-bundle-runner.js
Line 66 in7094fc0
When Webpack 5 builds for a Node.js target, it uses the following code. Because
__filename
isundefined
,require("url").pathToFileURL(__filename)
breaks. Notice this is with bothoptimization.splitChunks
andoptimization.runtimeChunk
set tofalse
, and there are no chunks -- proven by theinstalledChunks
object below.The error message: