1

最新の webpack バージョンにアップグレードしようとしていますが、使用時にこれらのエラー メッセージが表示されるようになりました。webpack serve --hot --mode development --port 3000

ERROR in Conflict: Multiple assets emit different content to the same filename ./A-50a08b634ba9289cefda.map

ERROR in Conflict: Multiple assets emit different content to the same filename ./B-18c50412514091296e3d.map

ERROR in Conflict: Multiple assets emit different content to the same filename ./C-00a60de5f5a500386d5f.map

ERROR in Conflict: Multiple assets emit different content to the same filename ./D-17887f8cd059fe724e29.map

ERROR in Conflict: Multiple assets emit different content to the same filename ./E-315a596abbc5432ec621.map

ERROR in Conflict: Multiple assets emit different content to the same filename ./F-a5125e3b3128b127b17e.map

これは私のwebpack構成ファイルです:

const webpack = require('webpack');

module.exports = {
  entry: {
    A: './src/main/javascript/entrypoints/A.js',
    B: './src/main/javascript/entrypoints/B.js',
    C: './src/main/javascript/entrypoints/C.js',
    D: './src/main/javascript/entrypoints/D.js',
    E: './src/main/javascript/entrypoints/E.js',
    F: './src/main/javascript/entrypoints/F.js'
  },
  module: {
    rules: [{
      test: /\.js$/,
      exclude: /node_modules/,
      use: {
        loader: 'babel-loader',
        options: {
            presets: ['@babel/react', '@babel/preset-env']
        }
      }
    },{
        test: /css\/global\/.*\.css$/,
        use: [
            {
                loader: 'style-loader'
            }, {
                loader: 'css-loader',
                options: {
                    url: false
                }
            }
        ],
    },{
        test: /css\/module\/.*\.css$/,
        loader: "style-loader"
     },{
        test: /css\/module\/.*\.css$/,
        loader: "css-loader",
        options: {
          url: false,
          modules: {
            localIdentName: '[name]__[local]___[hash:base64:5]'
          }
        }
    }
    ]
  },
  resolve: {
    extensions: ['.js', '.json']
  },
  output: {
    path: __dirname + '/src/main/resources/static/js',
    publicPath: '/js',
    filename: '[name].js',
    sourceMapFilename: './[name]-[chunkhash].map'
  },
  devtool: 'source-map'
};

これは私のpackage.jsonです:

{
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "@babel/preset-env": "^7.12.11",
    "@babel/preset-react": "^7.12.10",
    "@hot-loader/react-dom": "^17.0.1+4.13.0",
    "babel-loader": "^8.2.2",
    "babel-preset-react": "^6.24.1",
    "css-loader": "5.0.1",
    "eslint": "^2.9.0",
    "source-map-explorer": "^2.5.2",
    "style-loader": "^2.0.0",
    "webpack": "^5.13.0",
    "webpack-cli": "^4.3.1",
    "webpack-dev-server": "^3.11.1"
  },
  "dependencies": {
    "babel-polyfill": "^6.26.0",
    "react": "^16.9.0",
    "redux": "^4.0.4",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0"
    ...
  }
}

私はおそらくばかげたことをしています。私が間違っているかもしれないことについて何か提案はありますか?

更新: 'source-map' の代わりに devtool: 'eval-source-map' を使用すると、エラーは発生しなくなりました。

4

1 に答える 1