bugsnag / webpack-bugsnag-plugins

Webpack plugins for common BugSnag actions.
MIT License
32 stars 29 forks source link

TypeError: Cannot read property 'existsAt' of undefined #18

Closed archseer closed 5 years ago

archseer commented 6 years ago

I'm trying to use this with the vue-cli 3.0 build.

vue.config.js

const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const CompressionPlugin = require('compression-webpack-plugin');
const BrotliPlugin = require('brotli-webpack-plugin');
const { BugsnagSourceMapUploaderPlugin } = require('webpack-bugsnag-plugins');

module.exports = {
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      return {
        plugins: [
          new BugsnagSourceMapUploaderPlugin({
            apiKey: '<api key>',
            // appVersion: '1.0.0',
          }),
          new CompressionPlugin(),
          new BrotliPlugin(),
          new BundleAnalyzerPlugin({ analyzerMode: 'static' }),
        ],
      };
    }
    return {
      plugins: [
        new BundleAnalyzerPlugin({ openAnalyzer: false }),
      ],
    };
  },
  chainWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      return config.plugins.delete('fork-ts-checker');
    }
    return config;
  },
};
yarn run v1.9.4
$ vue-cli-service build

⠋  Building for production.../<vue project>/node_modules/webpack-bugsnag-plugins/source-map-uploader-plugin.js:54
            map: compilation.assets[map].existsAt,
                                         ^

TypeError: Cannot read property 'existsAt' of undefined
    at maps.map.map (/<vue project>/node_modules/webpack-bugsnag-plugins/source-map-uploader-plugin.js:54:42)
    at Array.map (<anonymous>)
    at chunkToSourceMapDescriptors (/<vue project>/node_modules/webpack-bugsnag-plugins/source-map-uploader-plugin.js:43:21)
    at Array.map (<anonymous>)
    at plugin (/<vue project>/node_modules/webpack-bugsnag-plugins/source-map-uploader-plugin.js:67:39)
    at _err0 (eval at create (/<vue project>/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:12:1)
    at callback (/<vue project>/node_modules/copy-webpack-plugin/dist/index.js:126:17)
    at afterEmit (/<vue project>/node_modules/copy-webpack-plugin/dist/index.js:220:13)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/<vue project>/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (/<vue project>/node_modules/tapable/lib/Hook.js:154:20)
    at asyncLib.forEach.err (/<vue project>/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:355:27)
    at done (/<vue project>/node_modules/neo-async/async.js:2854:11)
    at /<vue project>/node_modules/neo-async/async.js:2805:7
    at /<vue project>/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:141:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
archseer commented 6 years ago

Could be https://github.com/Izhaki/nodemon-webpack-plugin/commit/8475d3f7c3b9aecedaa2e3af61c77105d94b32c0

bengourley commented 6 years ago

Hey thanks for reporting the issue. I'll get this looked into. We're working on a lot of higher priority stuff right now so it may be a little while. Cheers!

archseer commented 6 years ago

So I've narrowed down what happens. Vue by default generates sourcemaps for only js, skipping css. This plugin is trying to upload both. Maybe it should skip anything not ending in ".js"?

alanaasmaa commented 5 years ago

Same issue here. I'm using Nuxt.js

 ERROR  Cannot read property 'existsAt' of undefined                                                                                                                                                                             09:20:48

  at maps.map.map (node_modules/webpack-bugsnag-plugins/source-map-uploader-plugin.js:53:48)
  at Array.map (<anonymous>)
  at chunkToSourceMapDescriptors (node_modules/webpack-bugsnag-plugins/source-map-uploader-plugin.js:43:21)
  at Array.map (<anonymous>)
  at plugin (node_modules/webpack-bugsnag-plugins/source-map-uploader-plugin.js:67:39)
  at _err0 (eval at create (node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:19:1)
  at reportBuild.then.catch (node_modules/webpack-bugsnag-plugins/build-reporter-plugin.js:20:11)
  at process._tickCallback (internal/process/next_tick.js:68:7)
markbrouch commented 5 years ago

@bengourley

Hey thanks for reporting the issue. I'll get this looked into. We're working on a lot of higher priority stuff right now so it may be a little while. Cheers!

Eagerly awaiting this fix. Seems this plugin is unusable for Vue apps in the meantime.

sarink commented 5 years ago

I had this happen when my entry file was incorrect, double check it!