未捕获的运行时错误:等待层“根”准备就绪时超时

问题描述 投票:0回答:1

由于需要加载器,我们的应用程序需要 Webpack 来升级到最新版本的第三方库。尝试使用各种开发工具(源映射类型)、从 Overlay 类进行日志记录来查明问题的根源,但无济于事。还没找到有同样问题的人。任何提示或帮助将不胜感激。另外,第一次海报 - 如果缺少信息,请道歉。

Webpack 配置:

const path = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    entry: './src/entry.js',

    //devtool: 'inline-source-map',
    devtool: 'eval-source-map',

    output: {
        path: path.join(__dirname, '/dist'),
        filename: 'bundle.js'
    },

    resolve: {
        extensions: ['.wasm', '.mjs', '.js', '.jsx', '.json', '.ts', '.tsx'],
        extensionAlias: {
          '.jsx': ['.tsx', '.jsx'],
          '.js': ['.ts', '.js'],
        },
    },

    plugins: [
        new HTMLWebpackPlugin({
            template: './src/index.html'
        })
    ],

    module: {
        rules: [
            {
                test: /\.(jsx?|tsx?)$/,
                exclude: [/photon_painter.js/],
                loader: "babel-loader",
                options: {
                  cacheDirectory: true,
                  configFile: "./transpile-browser.babelrc"
                }
            },
            {
                test: /\.txt$/i,
                use: 'raw-loader'
            },
            {
                test: /\.css$/,
                use: ['style-loader','css-loader']
            },
            {
                test: /\.(jpe?g|png|gif|svg)$/i,
                use: ['img-loader']
            },
            {
                test: /\.(?:ico|png|svg|jpg|jpeg|gif)$/i,
                type: 'asset/resource'
            },
            {
                test: /\.html$/,
                use: 'html-loader'
            },
            {
                test: /\.(manifest\.json)$/i,
                type: 'asset/resource'
            },
        ]
    },

    devServer: {
        hot: true,
        open: true,
        static: [{
            directory: path.resolve(__dirname, './dist')
          }]
    }
}
reactjs webpack runtime-error
1个回答
0
投票

尝试在watchOptions下设置更高的aggregateTimeout

此处的文档和参考资料:https://webpack.js.org/configuration/watch/#watchoptions

让我知道这是否有帮助

© www.soinside.com 2019 - 2024. All rights reserved.