created: 2020-04-14T03:15:24.000Z

runtime-only build of Vue where the template compiler is not available

vueコンポーネントが混ざったjsのテストで以下のようなwarningがでる

[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build

これは、単一ファイルコンポーネントではないVueコンポーネント( runtime-only build )をランタイムでコンパイルなしに使おうとしていて咎められているようだ

templateをコンパイル済みのjsコードを用意するか、compiler-included build のvueを使うかが逃げ道として提示されている

compiler-included build のvueを使うほうが楽そうだ。jestでテストを走らせているので、そのランタイムでcompiler-included build のvueが使われるようにする

具体的には jest.config.js にて moduleNameMapper に以下の設定を入れる

// commonjsのプロジェクトなので `vue.common.dev.js`
moduleNameMapper = {'^vue$': 'vue/dist/vue.common.dev.js'}

参考

パシフィック・リム [Blu-ray]
[ad] パシフィック・リム [Blu-ray]
出演 チャーリー・ハナム, イドリス・エルバ (Blu-ray)