[Vuejs]-Vue & webpack & typescript "Cannot access '__WEBPACK_DEFAULT_EXPORT__' before initialization"

0๐Ÿ‘

โœ…

I just bumped into the same problem and, after hours of Googling, I finally found the solution in a corner of Vue documentations.

Basically, you need to add an extra appendTsSuffixTo option to your webpack configuration.

module.exports = {
  ...
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: 'ts-loader',
        options: {
          appendTsSuffixTo: [/\.vue$/],
        },
        exclude: /node_modules/,
      },
      {
        test: /\.vue$/,
        loader: 'vue-loader',
      }

Leave a comment