Webpack模块警告:无法从“data”URL解析源Map

9lowa7mx  于 2022-11-24  发布在  Webpack
关注(0)|答案(9)|浏览(624)

我收到了一个令人沮丧的警告,但一直找不到可用的解决方案:

WARNING in ../lensing/dist/main.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from "data" URL: data:application/json;charset=utf-8;base64,eyJ2ZXJza [...]

我的webpack.config.js看起来像(为npm模块设置):

module.exports = {
    entry: './src/index.js',
    output: {
        filename: 'main.js',
        path: path.resolve(__dirname, 'dist'),
        library: 'lensing',
        libraryTarget: 'umd',
        umdNamedDefine: true
    },
    module: {
        rules: [
            {
                test: /\.m?js$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env'],
                        plugins: [
                            '@babel/plugin-proposal-class-properties'
                        ]
                    }
                }
            },
            {
                test: /\.js$/,
                enforce: 'pre',
                use: ['source-map-loader'],
            },
            {
                test: /\.(png|jpg|gif|svg)$/i,
                use: [
                    {
                        loader: 'url-loader',
                        options: {
                            limit: 8192,
                        },
                    },
                ],
            }
        ]
    },
    stats: {
        warningsFilter: [/Failed to parse source map/],
    },
};

我很惊讶没有找到关于这个特定问题的其他信息,我担心我错过了一些通常很简单的东西。我很高兴包括任何其他可能有用的代码片段,但我希望错误代码可能是一个强有力的指示器。
任何建议都将受到热烈欢迎!
编辑-更多上下文:

Version: webpack 4.43.0
Time: 6561ms
Built at: 07/31/2020 11:20:55 AM
                               Asset       Size  Chunks             Chunk Names
aafa1b05e4b76ffd04c1fe92edbf15f2.svg  654 bytes          [emitted]  
                             main.js    3.6 MiB    main  [emitted]  main
Entrypoint main = main.js
[0] multi (webpack)-dev-server/client?http://localhost:9000 ./src/index.js 40 bytes {main} [built]
[../lensing/dist/main.js] 2.46 MiB {main} [built] [1 warning]
[./node_modules/openseadragon/build/openseadragon/openseadragon.js] 674 KiB {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:9000] (webpack)-dev-server/client?http://localhost:9000 4.29 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {main} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {main} [built]
[./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js] (webpack)-dev-server/node_modules/strip-ansi/index.js 162 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./src/PIA23533_index32.csv] 622 bytes {main} [built]
[./src/index.css] 519 bytes {main} [built]
[./src/index.js] 1.69 KiB {main} [built]
    + 27 hidden modules

WARNING in ../lensing/dist/main.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from "data" URL: data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvdmlld2ZpbmRlci5qcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL2xlbnNpbmcvLi9zcmMvdmlld2ZpbmRlci5qcz9iNWVmIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGQzIGZyb20gJ2QzJztcblxuLyoqXG4gKiBAY2xhc3MgVmlld2ZpbmRlclxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBWaWV3ZmluZGVyIHtcblxuICAgIC8vIENsYXNzIHJlZnNcbiAgICBsZW5zaW5nID0gbnVsbDtcblxuICAgIC8vIERhdGFcbiAgICBkYXRhID0gbnVsbDtcbiAgICBvbiA9IGZhbHNlO1xuXG4gICAgLy8gRWxlbWVudHNcbiAgICBlbHMgPSB7XG4gICAgICAgIGRhdGFQb2ludEc6IG51bGwsXG4gICAgICAgIGc6IG51bGwsXG4gICAgICAgIHJhZGlhbEc6IG51bGwsXG4gICAgICAgIHN2ZzogbnVsbCxcbiAgICAgICAgYm94RzogbnVsbFxuICAgIH07XG5cbiAgICAvLyBDb25maWdzXG4gICAgY29uZmlncyA9IHtcbiAgICAgICAgYm94VzogMTUwLFxuICAgICAgICBib3hIOiA1MCxcbiAgICAgICAgZGVnOiAwLFxuICAgICAgICBleHRlbmQ6IDIwMCxcbiAgICAgICAgZ01hcmdpbjoge3RvcDogMCwgbGVmdDogMCwgcmlnaHQ6IDAsIGJvdHRvbTogMH0sXG4gICAgICAgIGdIOiAwLFxuICAgICAgICBnVzogMCxcbiAgICAgICAgaDogMCxcbiAgICAgICAgcjogMCxcbiAgICAgICAgclBvaW50ZXI6IDAsXG4gICAgICAgIHJQb2ludGVyRXh0OiAyNSxcbiAgICAgICAgdzogMCxcbiAgICB9O1xuXG4gICAgLy8gVG9vbHMgLSBUT0RPIGFkZCBib3hTY2FsZSB0byB0cmFjZSBwZXJpbWV0ZXJcbiAgICB0b29scyA9IHtcbiAgICAgICAgY29vcmRTY2FsZTogZDMuc2NhbGVMaW5lYXIoKVxuICAgICAgICAgICAgLmRvbWFpbihbMCwgMzYwXSlcbiAgICAgICAgICAgIC5yYW5nZShbTWF0aC5QSSwgLU1hdGguUEldKSxcbiAgICAgICAgbGluZU1ha2VyOiBkMy5saW5lKCksXG4gICAgICAgIHhTY2FsZTogZDMuc2NhbGVMaW5lYXIoKSxcbiAgICAgICAgeVNjYWxlOiBkMy5zY2FsZUxpbmVhcigpXG4gICAgfVxuXG4gICAgLypcbiAgICBDb25zdHJ1Y3RvclxuICAgICAqL1xuICAgIGNvbnN0cnVjdG9yKF9sZW5zaW5nKSB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dHRyKCd5JywgYCR7TWF0aC5yb3VuZCh2aXMuY29uZmlncy5ib3hIIC8gMyl9cHhgKVxuICAgICAgICAgICAgLmF0dHIoJ3RleHQtYW5jaG9yJywgJ21pZGRsZScpXG4gICAgICAgICAgICAuYXR0cignYWxpZ25tZW50LWJhc2VsaW5lJywgJ21pZGRsZScpXG4gICAgICAgICAgICAuc3R5bGUoJ2ZvbnQtZmFtaWx5JywgJ3NhbnMtc2VyaWYnKVxuICAgICAgICAgICAgLnN0eWxlKCdmb250LXNpemUnLCAnMTJweCcpXG4gICAgICAgICAgICAuc3R5bGUoJ2ZvbnQtd2VpZ2h0JywgJ2xpZ2h0ZXInKTtcbiAgICAgICAgdmlzLmVscy5ib3hHLmFwcGVuZCgndGV4dCcpXG4gICAgICAgICAgICAuYXR0cignY2xhc3MnLCAndmlld2ZpbmRlcl9ib3hfdGV4dCB2aWV3ZmluZGVyX2JveF90ZXh0X2InKVxuICAgICAgICAgICAgLmF0dHIoJ2ZpbGwnLCAnd2hpdGUnKVxuICAgICAgICAgICAgLmF0dHIoJ3gnLCBgJHt2aXMuY29uZmlncy5ib3hXIC8gMn1weGApXG4gICAgICAgICAgICAuYXR0cigneScsIGAke01hdGgucm91bmQodmlzLmNvbmZpZ3MuYm94SCAqIDIgLyAzKX1weGApXG4gICAgICAgICAgICAuYXR0cigndGV4dC1hbmNob3InLCAnbWlkZGxlJylcbiAgICAgICAgICAgIC5hdHRyKCdhbGlnbm1lbnQtYmFzZWxpbmUnLCAnbWlkZGxlJylcbiAgICAgICAgICAgIC5zdHlsZSgnZm9udC1mYW1pbHknLCAnc2Fucy1zZXJpZicpXG4gICAgICAgICAgICAuc3R5bGUoJ2ZvbnQtc2l6ZScsICcxMXB4JylcbiAgICAgICAgICAgIC5zdHlsZSgnZm9udC1zdHlsZScsICdpdGFsaWMnKVxuICAgICAgICAgICAgLnN0eWxlKCdmb250LXdlaWdodCcsICdsaWdodGVyJyk7XG5cbiAgICB9XG5cbiAgICAvKipcb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mdDogJHstdmlzLmNvbmZpZ3MuZXh0ZW5kfXB4OyB0b3A6ICR7LXZpcy5jb25maWdzLmV4dGVuZH1weDtgKVxuXG4gICAgICAgICAgICAvLyBVcGRhdGUgcmFkaWFsR1xuICAgICAgICAgICAgdmlzLmVscy5yYWRpYWxHLnN0eWxlKCd0cmFuc2Zvcm0nLCBgdHJhbnNsYXRlKCR7dmlzLmNvbmZpZ3MuZ1cgLyAyfXB4LCAke3Zpcy5jb25maWdzLmdIIC8gMn1weClgKVxuXG4gICAgICAgICAgICAvLyBVcGRhdGUgZGF0YVBvaW50R1xuICAgICAgICAgICAgdmlzLmVscy5kYXRhUG9pbnRHXG4gICAgICAgICAgICAgICAgLmRhdHVtKHZpcy5kYXRhKVxuICAgICAgICAgICAgICAgIC5lYWNoKGZ1bmN0aW9uIChkKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGcgPSBkMy5zZWxlY3QodGhpcyk7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gUG9pbnRlciBjb29yZHNcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcENvb3JkcyA9IGdldENvb3Jkcyh2aXMuY29uZmlncy5yUG9pbnRlciwgdmlzLmRlZyAtIDkwKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYWRkWCA9IE1hdGgucm91bmQodmlzLnRvb2xzLnhTY2FsZShwQ29vcmRzWzBdKSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGFkZFkgPSBNYXRoLnJvdW5kKHZpcy50b29scy55U2NhbGUocENvb3Jkc1sxXSkpO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIFVwZGF0ZSBwYXRoXG4gICAgICAgICAgICAgICAgICAgIGcuc2VsZWN0KCdwYXRoJylcbiAgICAgICAgICAgICAgICAgICAgICAgIC5hdHRyKCdkJywgdmlzLnRvb2xzLmxpbmVNYWtlcihbWzAsIDBdLCBwQ29vcmRzXSkpO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIFVwZGF0ZSBib3hHIHZpc2liaWxpdHksIHBvc1xuICAgICAgICAgICAgICAgICAgICB2aXMuZWxzLmJveEcuc3R5bGUoJ3Zpc2liaWxpdHknLCAndmlzaWJsZScpO1xuICAgICAgICAgICAgICAgICAgICB2aXMuZWxzLmJveEcuc3R5bGUoJ3RyYW5zZm9ybScsIGB0cmFuc2xhdGUoJHtwQ29vcmRzWzBdICsgYWRkWH1weCwgJHtwQ29vcmRzWzFdICsgYWRkWX1weClgKTtcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgLyogZ2V0Q29vcmRzICovXG4gICAgICAgICAgICBmdW5jdGlvbiBnZXRDb29yZHMociwgaSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHggPSBNYXRoLnJvdW5kKHIgKiBNYXRoLnNpbih2aXMudG9vbHMuY29vcmRTY2FsZShpKSkpO1xuICAgICAgICAgICAgICAgIGNvbnN0IHkgPSBNYXRoLnJvdW5kKHIgKiBNYXRoLmNvcyh2aXMudG9vbHMuY29vcmRTY2FsZShpKSkpO1xuICAgICAgICAgICAgICAgIHJldHVybiBbeCwgeV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgIC8vIEhpZGVcbiAgICAgICAgICAgIHZpcy5lbHMuYm94Ry5zdHlsZSgndmlzaWJpbGl0eScsICdoaWRkZW4nKTtcbiAgICAgICAgfVxuXG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQGZ1bmN0aW9uIHVwZGF0ZV9ib3hfdGV4dFxuICAgICAqIFVwZGF0ZXMgdGhlIHRleHQgZnJvbSBkYXRhXG4gICAgICpcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gZFxuICAgICAqXG4gICAgICovXG4gICAgdXBkYXRlX2JveF90ZXN0KGQpIHtcbiAgICAgICAgLy8gRGVmaW5lIHRoaXNcbiAgICAgICAgY29uc3QgdmlzID0gdGhpcztcblxuICAgICAgICAvLyBVcGRhdGVcbiAg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E7QUFDQTtBQUNBO0FBQ0E7QUE4QkE7QUE5QkE7QUFnQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQWxDQTtBQUNBO0FBQ0E7QUFJQTtBQUNBO0FBRUE7QUFHQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBR0E7QUFDQTtBQUNBO0FBUUE7QUFFQTtBQUNBO0FBQ0E7QUFFQTtBQUVBOzs7Ozs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUVBO0FBRUE7Ozs7OzsiLCJzb3VyY2VSb290IjoiIn0=\n//#
 @ ./src/index.js 3:0-29 65:19-30
vwkv1x7d

vwkv1x7d1#

一个更好的方法。下面的代码保留了源代码Map,只是删除了垃圾邮件警告。

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/,
        enforce: "pre",
        use: ["source-map-loader"],
      },
    ],
  },
  ignoreWarnings: [/Failed to parse source map/],
};
t8e9dugd

t8e9dugd2#

如果您在使用react-scripts/cra版本5.0.0时遇到此问题,您需要将以下内容添加到您的.env文件中

**注意:**这不是修正。您正在隐藏来源唐飞警告,但它可能会让您看不到这些警告,因为所有其他解决方案都不起作用。

GENERATE_SOURCEMAP=false
也可以更新脚本以

"start": "GENERATE_SOURCEMAP=false react-scripts start",

**注意:**这是5.0.1发布前的临时补丁。请参见create-react-app repo pull request**更新:**5.0.1已于2022年4月发布。Changelog。更新未修复此问题。不确定何时发布🤷🏾‍♂️

qq24tv8q

qq24tv8q3#

我也有同样的问题。
这不是一个解决方案,但比另一个“答案”更好的解决方案:
将source-map-loader webpack.config.js模块.rules设置更改为:

//module.rules:[
            {
                    test: /\.js$/,
                    enforce: 'pre',
                    use: [
                        {
                            //needed to chain sourcemaps.  see: https://webpack.js.org/loaders/source-map-loader/
                            loader: 'source-map-loader',
                            options: {

                                filterSourceMappingUrl: (url, resourcePath) => {
                                    //  console.log({ url, resourcePath }) example:
                                    // {
                                    //  url: 'index.js.map',
                                    //  resourcePath: '/repos/xlib-wsl/common/temp/node_modules/.pnpm/https-proxy-agent@5.0.0/node_modules/https-proxy-agent/dist/index.js'
                                    // }

                                    if (/.*\/node_modules\/.*/.test(resourcePath)) {
                                        return false
                                    }
                                    return true
                                }

                            }
                        }],
                },

也就是说,不要为node_module依赖项加载源Map。

f45qwnt8

f45qwnt84#

{
    test: [/\.js?$/, /\.ts?$/, /\.jsx?$/, /\.tsx?$/],
    enforce: 'pre',
    exclude: /node_modules/,
    use: ['source-map-loader'],
},

包括在配置文件中,并下载source-map-loader作为dev-dependency

lrpiutwd

lrpiutwd5#

除了上述解决方案之外,在使用添加了react-app-rewiredcustomize-cracreate-react-app时,还可以消除源Map警告更新config-overrides.js并设置ignoreWarnings

const { override } = require("customize-cra");

const ignoreWarnings = value => config => {
  config.ignoreWarnings = value;
  return config;
};

module.exports = override(
  ignoreWarnings([/Failed to parse source map/])
);
0kjbasz6

0kjbasz66#

扩展FrozenKiwi对Craco的回答

// craco.config.js
module.exports = {
    reactScriptsVersion: "react-scripts" /* (default value) */,
    webpack: {
        mode: 'extends',
        configure: {
            module: {
                rules: [
                    {
                        test: /\.js$/,
                        enforce: "pre",
                        use: ["source-map-loader"],
                    },
                ],
            },
            ignoreWarnings: [/Failed to parse source map/],
        },
    },
}
zynd9foi

zynd9foi7#

为什么要警告?
我在一个npm软件包上以watch模式运行webpack,并在一个演示应用程序上测试它,该应用程序也使用npm link [package-name]以watch模式运行webpack。
开发人员的解决方法:
从演示中的webpack.config.js中删除source-map-loader

wz8daaqr

wz8daaqr8#

面对同样的问题,我认为你的api没有被调用,因为cors的问题

2exbekwf

2exbekwf9#

这个解决方案可以帮助我创建React应用程序。
您可以通过编辑文件node_modules/react-scripts/config/webpack.config.js并将其粘贴到行性能之后来添加此修复程序:假,

ignoreWarnings: [
  // Ignore warnings raised by source-map-loader.
  // some third party packages may ship miss-configured sourcemaps, that interrupts the build
  // See: https://github.com/facebook/create-react-app/discussions/11278#discussioncomment-1780169
  /**
   *
   * @param {import('webpack').WebpackError} warning
   * @returns {boolean}
   */
  function ignoreSourcemapsloaderWarnings(warning) {
    return (
      warning.module &&
      warning.module.resource.includes('node_modules') &&
      warning.details &&
      warning.details.includes('source-map-loader')
    );
  },
],

但是当你进行yarn安装或npm安装时,你的编辑将被删除。

相关问题