Webpack config has an unknown property 'preLoaders'

后端 未结 6 2056
青春惊慌失措
青春惊慌失措 2020-12-29 03:57

I\'m learning webpack from scratch. I\'ve learned how to link javascript files with require. I\'m bundling and minifying my js files and i\'m listening for changes with watc

6条回答
  •  无人及你
    2020-12-29 05:01

    use this one instead ./webpack.config.js

     var path = require('path');
    
    module.exports = {
       entry: './main.ts',
       resolve: {
         extensions: ['.webpack.js', '.web.js', '.ts', '.js']
       },
       module: {
         rules: [
          {
            test: /\.tsx?$/,
            use: 'ts-loader',
            exclude: /node_modules/
          }
        ]
       },
       output: {
         filename: 'bundle.js',
         path: path.resolve(__dirname, 'dist')
       }
     }
    

    the documentation can be found here the problem is related to the version of ts-loader you installed

提交回复
热议问题