L
L
lookingfor22021-05-16 22:30:19
webpack
lookingfor2, 2021-05-16 22:30:19

Why won't VUE connect?

my webpack

module.exports = {
  context: path.resolve(__dirname, dir),
  mode: 'development',
  watch: isDev,
  devtool: isDev ? 'source-map' : false,
  entry: { // точка входа
    index: './js/index/index.js', // точка входа на главную
    quiz: './js/main/main.js', // точка входа в vue
  },
  output: {
    filename: filename('js'), // паттерн name и паттерн hash
    path: path.resolve(__dirname, 'dist')
  },
  resolve: {
    extensions: ['.js', '.json', '.png', '.vue'],// указываем расширение для файлов, чтобы не указывать их при подключении
    alias: {
      '@models': path.resolve(__dirname, dir+'/models'),
      '@styles': path.resolve(__dirname, dir+'/styles'),
      '@': path.resolve(__dirname, dir)
    }
  },
module: {
    rules: [
      {
        test: /\.css$/,
        use: cssLoaders()
      },
      {
        test: /\.less$/,
        use: cssLoaders('less-loader')
      },
      {
        test: /\.s[ac]ss$/,
        use: cssLoaders('sass-loader')
      },
      {
        test: /\.(png|jpg|svg|gif)$/,
        loader: 'file-loader',
        options: {
          name() {
            if (isDev) {
              return '[path][name].[ext]';
            }
            return '[hash].[ext]';
          },
        }
      },
      {
        test: /\.(ttf|woff|woff2|eot)$/,
        use:['file-loader']
      },
      {
        test: /\.xml$/,
        use:['xml-loader']
      },
      {
        test: /\.csv$/,
        use:['csv-loader']
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: jsLoaders()
      },
      {
        test: /\.ts$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: babelOptions('@babel/preset-typescript')
        }
      },
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          loaders: {
            js: 'babel-loader'
          }
        }
      },
    ]
  }

the main.js file, the log does not even see the html page from this file, while I see that the file is included in the source
If you comment out the vue connection, the log shows that I did something wrong in webpack or in main.js?

import Vue from 'vue'
import App from './App.vue'
import Vuex from 'vuex'
import VueRouter from 'vue-router'
Vue.config.productionTip = false
new Vue({
  Vuex,
  VueRouter,
  render: h => h(App),
}).$mount('#app')
console.log('s222222222ss');

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question