Webpack - React searchParams Error

Hi all,

I am developing an application using webpack and react. I was able to view successfully.

but I get an error when I use search params specific to the application.


how can i solve this problem.
Thank you

Webpack config =>

const path = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin');
const cesiumSource = 'node_modules/cesium/Source';
const cesiumWorkers = '../Build/Cesium/Workers';
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const TerserPlugin = require("terser-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
    entry: {
        index:path.resolve(__dirname, 'src', 'index.js')
    },

    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: "[name].bundle.js",
        sourcePrefix: ''

    },
    amd: {
        // Enable webpack-friendly use of require in Cesium
        toUrlUndefined: true
    },

    resolve: {
        alias: {
            cesium: path.resolve(__dirname, cesiumSource)
        },
        mainFiles: ['module', 'index', 'Cesium'],
        fallback: { https: false, zlib: false, http: false, url: false },
    },
    optimization: {
        splitChunks: {
            chunks: "initial",
            minChunks: 1,
            maxSize: 1000000,
            minSize: 30000,
            name: "cesium",
        },
        minimize: true,
        minimizer: [
            new TerserPlugin({
                test: /\.js(\?.*)?$/i,
            }),
        ],
    },
    plugins: [
        new HTMLWebpackPlugin({
            template: path.resolve(__dirname, "src", "index.html")
        }),
        new MiniCssExtractPlugin(),
        new CopyWebpackPlugin({
            patterns: [
                { from: path.join(cesiumSource, cesiumWorkers), to: 'Workers' },
                { from: path.join(cesiumSource, 'Assets'), to: 'Assets' },
                { from: path.join(cesiumSource, 'Widgets'), to: 'Widgets' }
            ]
        }),
        new webpack.DefinePlugin({
            // Define relative base path in cesium for loading assets
            CESIUM_BASE_URL: JSON.stringify('/')
        }),


    ],

    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env', '@babel/preset-react']
                    }
                }
            },
            {
                test: /\.(sa|sc|c)ss$/i,
                //use: ['style-loader', "css-loader", "sass-loader"]
                use:[MiniCssExtractPlugin.loader, 'css-loader']
            },
            {
                test: /\.(png|gif|jpg|jpeg|xml)$/,
                use: [ 'url-loader' ]
            },
            {
                test: /\.(woff|woff2|eot|ttf|svg|otf)$/,
                loader: "file-loader",
                options: {
                    outputPath: "font",
                }
            },
            {
                test: /\.json5$/i,
                use: ['json-loader']
            }
        ]
    }
}

From the error, it looks like CESIUM_BASE_URL is not being set correctly. Based on the [recommended webpack config[(https://github.com/CesiumGS/cesium-webpack-example/blob/main/webpack.config.js), you may want to set this to:

CESIUM_BASE_URL: JSON.stringify('')