用npx编译时入口文件报错

错误提示

webpack.config.js文件

const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const checkerPlugin = require('awesome-typescript-loader').CheckerPlugin;

module.exports = () => {
    return [{
        mode: 'development',
        entry: {
            app: './src/index.tsx',
            vendor: ['react', 'react-dom', 'antd']
        },
        output: {
            path: path.resolve(__dirname, './wwwroot/dist'),
            filename: '[name].js',
            publicPath: 'dist/'
        },
        module: {
            rules: [
                {
                    test: /\.tsx?$/, include: '/src/', use: 'awesome-typescript-loader?silent=true'
                }, {
                    test: /\.css$/,
                    loader: ExtractTextPlugin.extract({
                        fallback: 'style-loader',
                        use: ['css-loader']
                    })
                }, {
                    test: /\.less$/,
                    loader: ExtractTextPlugin.extract({
                        fallback: 'style-loader',
                        use: ['css-loader', 'less-loader']
                    })
                },
                { test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'file-loader?limit=100000' },
                { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'file-loader?limit=25000' }
            ]
        },
        resolve: {
            extensions: ['.js', '.jsx', '.ts', '.tsx']
        },
        externals: {
            "react": "React",
            "react-dom": "ReactDOM",
            "antd": "Antd"
        },
        plugins: [
            new checkerPlugin()
        ]
    }];
};
阅读 1.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进