Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/vuePublic

fix(server-renderer): provide __filename to vm for webpack#12242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
privatenumber wants to merge1 commit intovuejs:dev
base:dev
Choose a base branch
Loading
fromprivatenumber:fix-webpack-require

Conversation

privatenumber
Copy link
Contributor

@privatenumberprivatenumber commentedAug 24, 2021
edited
Loading

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

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:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

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'}

weikinhuang, mannymu, liuzh1516, gggogogo, and Coiggahou2002 reacted with thumbs up emoji
@privatenumber
Copy link
ContributorAuthor

FYI this PR seems to have been closed when moved to "Done", but not merged

@lzxb
Copy link
Contributor

When is this expected to be released

@privatenumber
Copy link
ContributorAuthor

Not sure if there's a target date but it's in the2.6.15 project so you can see how much work needs to be done before it's released.

@privatenumber
Copy link
ContributorAuthor

@posva
This may have been overlooked. Any chance it can be revisited & released?

@niksy
Copy link

Also looking for this. Is there any possibility to have this included in 2.7.x release?

@gggogogo
Copy link

+10086. it can be released?

@Coiggahou2002
Copy link

Also looking for this. Is there any possibility to have this included in 2.7.x release? Otherwise I can only fork it myself.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@privatenumber@lzxb@niksy@gggogogo@Coiggahou2002

[8]ページ先頭

©2009-2025 Movatter.jp