0
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?

vue3 vite didn't resolve at build time, it will remain unchanged to be resolved at runtime

Posted at

表題の通りのエラー

didn't resolve at build time, it will remain unchanged to be resolved at runtime

出ちゃったね!

css に background url を設定していると出るみたい。

hoge.css
.sb-bg{
    width: 100%;
    height: 0;
    /* (画像の高さ / 画像の横幅) × 100 */
    padding-top: 47.804878%;
    background: url('/img/sb1.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

とりあえずの解決として、以下のように画像ファイルだけ直接埋め込みにした。

hoge.css
.sb-bg{
    width: 100%;
    height: 0;
    /* (画像の高さ / 画像の横幅) × 100 */
    padding-top: 47.804878%;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}
hoge.vue
<div class="sb-bg" style="background: url('/img/sb1.png');"></div>

これで解決。

0
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
0
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?