Closed cxgreat2014 closed 3 years ago
您好,新建ssr midwayjs+vue3项目后使用vite访问任意页面404,操作步骤与debug日志如下:
$ npm init ssr-app wenku -- --template=midway-vue3-ssr $ cd wenku && yarn && yarn add -D vite @vitejs/plugin-vue
$ yarn vite -d yarn run v1.22.10 $ D:\test\wenku\node_modules\.bin\vite -d vite:config no config file found. +0ms [dotenv][DEBUG] did not match key and value when parsing line 1: [dotenv][DEBUG] did not match key and value when parsing line 6: vite:config using resolved config: { vite:config root: 'D:/test/wenku', vite:config base: '/', vite:config mode: 'development', vite:config configFile: undefined, vite:config logLevel: undefined, vite:config clearScreen: undefined, vite:config server: {}, vite:config inlineConfig: { vite:config root: undefined, vite:config base: undefined, vite:config mode: undefined, vite:config configFile: undefined, vite:config logLevel: undefined, vite:config clearScreen: undefined, vite:config server: {} vite:config }, vite:config resolve: { dedupe: undefined, alias: [ [Object] ] }, vite:config publicDir: 'D:\\test\\wenku\\public', vite:config command: 'serve', vite:config isProduction: false, vite:config optimizeCacheDir: 'D:\\test\\wenku\\node_modules\\.vite', vite:config plugins: [ vite:config 'vite:pre-alias', vite:config 'alias', vite:config 'vite:dynamic-import-polyfill', vite:config 'vite:resolve', vite:config 'vite:html', vite:config 'vite:css', vite:config 'vite:esbuild', vite:config 'vite:json', vite:config 'vite:wasm', vite:config 'vite:worker', vite:config 'vite:asset', vite:config 'vite:define', vite:config 'vite:css-post', vite:config 'vite:client-inject', vite:config 'vite:import-analysis' vite:config ], vite:config build: { vite:config target: [ 'es2019', 'edge18', 'firefox60', 'chrome61', 'safari11' ], vite:config polyfillDynamicImport: true, vite:config outDir: 'dist', vite:config assetsDir: 'assets', vite:config assetsInlineLimit: 4096, vite:config cssCodeSplit: true, vite:config sourcemap: false, vite:config rollupOptions: {}, vite:config commonjsOptions: { include: [Array], extensions: [Array] }, vite:config minify: 'terser', vite:config terserOptions: {}, vite:config cleanCssOptions: {}, vite:config write: true, vite:config emptyOutDir: null, vite:config manifest: false, vite:config lib: false, vite:config ssr: false, vite:config ssrManifest: false, vite:config brotliSize: true, vite:config chunkSizeWarningLimit: 500 vite:config }, vite:config env: { BASE_URL: '/', MODE: 'development', DEV: true, PROD: false }, vite:config assetsInclude: [Function: assetsInclude], vite:config logger: { vite:config hasWarned: false, vite:config info: [Function: info], vite:config warn: [Function: warn], vite:config error: [Function: error], vite:config clearScreen: [Function: clearScreen] vite:config }, vite:config createResolver: [Function: createResolver] vite:config } +8ms vite:deps Hash is consistent. Skipping. Use --force to override. +0ms vite v2.1.5 dev server running at: > Network: http://172.18.0.1:3000/ > Network: http://172.20.192.1:3000/ > Network: http://192.168.10.157:3000/ > Network: http://172.16.3.168:3000/ > Network: http://192.168.56.1:3000/ > Network: http://192.168.24.1:3000/ > Network: http://192.168.112.1:3000/ > Network: http://192.168.10.200:3000/ > Local: http://localhost:3000/ ready in 234ms. vite:hmr [file change] .idea/workspace.xml +0ms vite:hmr [no modules matched] .idea/workspace.xml +1ms vite:spa-fallback Rewriting GET /?csr=1 to /index.html +0ms vite:time 8ms /index.html +0ms
启动方式不对
npx ssr start --vite 或者直接 npm run start:vite
@cxgreat2014
启动方式不对 npx ssr start --vite 或者直接 npm run start:vite
明白了,使用yarn start:vite 成功启动,感谢~!
您好,新建ssr midwayjs+vue3项目后使用vite访问任意页面404,操作步骤与debug日志如下: