1

I have a HelloWorld.vue in my conponents.

In main.js, import it:

import HelloWorld from './components/HelloWorld.vue'

I see many Vue projects, it is import by this type, there is no .vue suffix:

import HelloWorld from './components/HelloWorld

Is there difference between the two ways to import?

qg_java_17137
  • 3,310
  • 10
  • 41
  • 84
  • 1
    See the top answer in https://stackoverflow.com/questions/34678314/webpack-cant-find-module-if-file-named-jsx - while it deals with `.jsx`, it details how Webpack can be told to look for certain extensions automatically. Basically, your Webpack config says "look for .vue files". There's no functional difference between the two - use what you prefer. – ceejayoz Feb 12 '18 at 02:55

0 Answers0