2
1

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 5 years have passed since last update.

Laravel-mixでVue.jsを外部ライブラリ化してJavaScriptファイルを軽量化する

Last updated at Posted at 2019-06-19

背景とか

コンパイルしたVue.jsを含むJSファイル大きすぎる。軽量化したい。

方法

externalを使ってVueを外部ライブラリ化する。

// webpack.mix.js
mix.webpackConfig({
    externals: {
        "vue": "Vue"
    }
});

その他

external使うとめっちゃ軽くなる!
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
を等を使ってVue.jsを読み込こんで、Vueをグローバルな変数として使わないとVue.jsが使えない。

良い解決方法があれば教えてクレメンス。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?