错误:在 bitbucket 中构建 vite 时,Rollup 无法解析导入“vue-router”

bor*_*iao 5 vue.js vite

错误:当在 bitbucket\nbitbucket-pipelines.yml 中构建 vite 时,Rollup 无法解析导入“vue-router”

\n
image: node:16\n\npipelines:\n  branches:\n    master:\n      - step:\n          name: install\n          caches:\n            - node\n          script:\n            - npm i\n      - step:\n          name: build\n          caches:\n            - node\n          script:\n            - npm run build\n          artifacts: # defining the artifacts to be passed to each future step\n            - dist/**\n      - step:\n          name: Deploy to Serve\n          deployment: Production\n          script:\n            - pipe: atlassian/sftp-deploy:0.5.5\n              variables:\n                USER: $FTP_USERNAME\n                SERVER: $FTP_HOST\n                REMOTE_PATH: $FTP_SITE_ROOT\n                PASSWORD: $SFTP_PASSWORD\n                LOCAL_PATH:  $BITBUCKET_CLONE_DIR/dist/*\n                DEBUG: 'true'\n
Run Code Online (Sandbox Code Playgroud)\n

错误信息\xef\xbc\x9a

\n

vite]: Rollup 无法解析从“src/router/index.js”导入“vue-router”。\n这很可能是无意的,因为它可能会在运行时破坏您的应用程序。\n如果您确实想要外部化此模块,请显式添加\n \n构建期间出现build.rollupOptions.external错误:\n错误:[vite]:汇总无法解析从“src/router/index.js”导入“vue-router”。\n这很可能是意外的,因为它可能会在以下位置中断您的应用程序\n如果您确实想要外部化此模块,请显式将其添加到\n build.rollupOptions.external\nat onRollupWarning (/opt/atlassian/pipelines/agent/build/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:43253: 19)\nat onwarn (/opt/atlassian/pipelines/agent/build/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:43037:13)\nat Object.onwarn (/opt/atlassian/pipelines/代理/构建/node_modules/rollup/dist/shared/rollup.js:23003:13)\nat ModuleLoader.handleResolveId (/opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:22347 :26)\nat /opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:22319:26

\n