vuejs/vue

vue ssr cli webpack bug

fykyx521 opened this issue · 1 comments

Version

2.7.14

Reproduction link

https://ip.w7.cc/

Steps to reproduce

package.json

  "devDependencies": {
    "@babel/core": "^7.12.16",
    "@babel/eslint-parser": "^7.12.16",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "cross-env": "^7.0.3",
    "eslint": "^7.32.0",
    "eslint-plugin-vue": "^8.0.3",
    "vue-template-compiler": "^2.6.14",
    "webpack-node-externals": "^3.0.0"
  },

webpack require(rootOutputDir = ../)

https://sourcegraph.com/github.com/webpack/webpack/-/blob/lib/node/RequireChunkLoadingRuntimeModule.js?L155:14

		hasJsMatcher === true
												? "if(true) { // all chunks have JS"
												: `if(${hasJsMatcher("chunkId")}) {`,
											Template.indent([
												`installChunk(require(${JSON.stringify(
													rootOutputDir
												)} + ${
													RuntimeGlobals.getChunkScriptFilename
												}(chunkId)));`
											]),
											"} else installedChunks[chunkId] = 1;",
											""
										]),

vue-ssr-server-bound.json no ../

"entry": "js/main.b7b5b1dc.js",
  "files": {
      "js/xxxxx" : "code here"  not ../
  }

vue-server-render/build-dev.js

    const r = file => {
            file = path$1.posix.join('.', file);
            file = file.replace('../', '/', file);//  i need add code 我需要加这行
            if (files[file]) {
                return evaluateModule(file, sandbox, evaluatedFiles);
            }
            else if (basedir) {
                return require(resolvedModules[file] ||
                    (resolvedModules[file] = resolve.sync(file, { basedir })));
            }
            else {
                return require(file);
            }
        };

What is expected?

file = file.replace('../', '/', file);// i need add code 我需要加这行

What is actually happening?

file = file.replace('../', '/', file);// i need add code 我需要加这行


i fix vue.config js out dir like this ?

@vue/cli-service/assert.js

  api.chainWebpack(webpackConfig => {
    webpackConfig.module
    .rule('svg')
      .test(/\.(svg)(\?.*)?$/)
      // do not base64-inline SVGs.
      // https://github.com/facebookincubator/create-react-app/pull/1180
      .set('type', 'asset/resource')
      .set('generator', {
        filename: genAssetSubPath('img')   //
      })

Hi, thanks for your interest but Github issues are for bug reports with up-to-date, minimal reproductions and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow.