vuetifyjs / webpack-ssr

Vuetify Webpack SSR Template
https://vuetifyjs.com/overview
62 stars 28 forks source link

Allow .vue files to be required without providing the extension #5

Closed dsbert closed 7 years ago

dsbert commented 7 years ago

Webpack is not set up by default to resolve .vue modules without providing an extension. Adding the following configuration will enable this ability.

// fails
import GetStartedView from '../views/GetStartedView'

// succeeds
import GetStartedView from '../views/GetStartedView.vue'

In webpack.base.config.js:

resolve: {
    extensions: ['*', '.js', '.json', '.vue'],
    alias: {
      'public': path.resolve(__dirname, '../public')
    }
  },
// succeeds
import GetStartedView from '../views/GetStartedView'

// succeeds
import GetStartedView from '../views/GetStartedView.vue'