Skip to content

Instantly share code, notes, and snippets.

@Coridyn
Created September 24, 2017 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Coridyn/f2f0d677329a510432388fced434712d to your computer and use it in GitHub Desktop.
Save Coridyn/f2f0d677329a510432388fced434712d to your computer and use it in GitHub Desktop.
Webpack + TypeScript + Vue

2017-09-24

Build Vue with template compiler

Make sure you have the vue$ alias in webpack.config.js:

{
    resolve: {
        alias: {
            'vue$': 'vue/dist/vue/esm.js',
        },
    },
}

If you still get an error like:

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.

Make sure your vue import in your scripts is spelled - a typeo can cause Vue to still load but not use the webpack alias:

// CORRECT - lowercase 'vue'
import Vue from 'vue'

// WRONG - shoule be 'vue' not 'Vue' for from statement
import Vue from 'Vue'

Webpack general

Make sure that '.js' is included in the list of extensions to resolve!

{
    resolve: {
        extensions: ['.js', '.ts', '.vue']
    },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment