[Vuejs]-Can't find module in vuejs error, but still builds fine

0๐Ÿ‘

โœ…

I solved it by adding โ€œ.vueโ€ to CreateBucketModal so its โ€˜../components/modal/CreateBucketModal.vueโ€.
Is there a way around this?

Being able to resolve single-file Vue components without the .vue extension is down to how Webpack is configured, specifically the resolve.extensions configuration.

The default for a Vue CLI v3 project is

resolve {
  extensions: [
    '.wasm',
    '.mjs',
    '.js',
    '.jsx',
    '.vue', // ๐Ÿ‘ˆ note this entry
    '.json'
  ]
}

I can only assume then that you have modified your Webpack config. If you are manipulating resolve.extensions, try adding to it instead of overwriting it, eg

// vue.config.js
module.exports = {
  configureWebpack: config => {
    config.resolve.extensions.push('.some.new.extension')
    // instead of config.resolve.extensions = ['.some.new.extension']
  }
}

See https://cli.vuejs.org/guide/webpack.html

Leave a comment