【问题标题】:build with multi page don't work with vite 2.6 and vue 3.2多页面构建不适用于 vite 2.6 和 vue 3.2
【发布时间】:2021-11-27 16:37:28
【问题描述】:

我用 vue 3.2 和 vite 2.6 做了一个简单的多页应用

|-src
|---main.js
|-package.json
|-vite.config.js
|-index.html
|-validation_password.html

但是当我想构建它时:vite 只构建索引页面(而不是验证密码)。 我尝试使用 here 之类的汇总选项修改我的 vite.config.js :

const { resolve } = require('path')

module.exports = defineConfig({
  build: {
    rollupOptions: {
      input: {
        main: resolve(__dirname, 'index.html'),
        valpass: resolve(__dirname, 'validation_password.html')
      }
    }
  }
})

构建失败。我的终端出现了这个错误:

[rollup-plugin-dynamic-import-variables] Unexpected token (1:0)
file: C:/wamp64/www/IMB/VueJS/vuejs/src/PassVal.vue:1:0
error during build:
SyntaxError: Unexpected token (1:0)
    at Parser.pp$5.raise (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:19495:13)
    at Parser.pp.unexpected (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:16820:8)
    at Parser.pp$4.parseExprAtom (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:18870:10)
    at Parser.pp$4.parseExprSubscripts (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:18662:19)
    at Parser.pp$4.parseMaybeUnary (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:18628:17)
    at Parser.pp$4.parseExprOps (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:18561:19)
    at Parser.pp$4.parseMaybeConditional (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:18544:19)
    at Parser.pp$4.parseMaybeAssign (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:18512:19)
    at Parser.pp$4.parseExpression (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:18476:19)
    at Parser.pp$1.parseStatement (C:\wamp64\www\IMB\VueJS\vuejs\node_modules\rollup\dist\shared\rollup.js:17010:45)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! components-portail-math@0.0.1 build: `vite build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the components-portail-math@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\willb\AppData\Roaming\npm-cache\_logs\2021-10-07T14_34_53_913Z-debug.log

我的 PassVal.vue 文件在本地破解无后顾之忧。 我不明白。我正在关注文档。

【问题讨论】:

  • 这是什么意思:“我的 PassVal.vue 文件在本地破解不用担心”PassVal.vue的内容是什么?你能分享一个重现问题的链接吗?
  • "locally" 是当我使用命令“vite serve”在浏览器中本地预览我的应用程序时。 (对不起,我是法国人;))

标签: vuejs3 vite


【解决方案1】:

我使用 Vue Router(我不知道)来解决我的问题。

【讨论】:

    猜你喜欢
    • 2022-07-12
    • 2021-07-30
    • 2022-11-23
    • 1970-01-01
    • 2022-07-27
    • 2021-08-22
    • 2021-06-24
    • 1970-01-01
    • 2021-11-28
    相关资源
    最近更新 更多