1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VITEでvue3.0プロジェクトをgithubpages用に書き出そうとしてエラー

Posted at

VITEでvue3.0プロジェクトをgithubpages用に書き出そうとしてエラー

vite v2.4.4 building for production...
✓ 17 modules transformed.
[vite]: Rollup failed to resolve import "assets/layout/images/logo-mobile.svg" from "src/pages/Error.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "assets/layout/images/logo-mobile.svg" from "src/pages/Error.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at onRollupWarning (/app/baixiangguo-client/node_modules/vite/dist/node/chunks/dep-c1a9de64.js:51765:19)
    at onwarn (/app/baixiangguo-client/node_modules/vite/dist/node/chunks/dep-c1a9de64.js:51550:13)
    at Object.onwarn (/app/baixiangguo-client/node_modules/rollup/dist/shared/rollup.js:20503:13)
    at ModuleLoader.handleResolveId (/app/baixiangguo-client/node_modules/rollup/dist/shared/rollup.js:19852:26)
    at /app/baixiangguo-client/node_modules/rollup/dist/shared/rollup.js:19799:22
    at async Promise.all (index 2)
    at async ModuleLoader.fetchStaticDependencies (/app/baixiangguo-client/node_modules/rollup/dist/shared/rollup.js:19797:34)
    at async Promise.all (index 0)
    at async ModuleLoader.fetchModule (/app/baixiangguo-client/node_modules/rollup/dist/shared/rollup.js:19773:9)
    at async Promise.all (index 3)
error Command failed with exit code 1.

色々調べてみて、rolupoptionを調べたりしたが、なんのこっちゃない、
場所が分からんのかも?と気づいてassetsをsrcの下にあることを明示したらい解決。

vite.config.ts
    { find: 'assets', replacement: 'src/assets'}]
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?