Preventing StackTrace is not defined on browser when using Browserify
See original GitHub issueI’m trying to use this lib with Browserify + ES6 syntax.
import { StackdriverErrorReporter } from 'stackdriver-errors-js'
But, when I try to test it with some error I receive this:
Uncaught ReferenceError: StackTrace is not defined at StackdriverErrorReporter.report
Everything works fine when I use self-hosted CDN.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
require is not defined error with browserify - Stack Overflow
Longer answer: You are getting the error because the method require is not defined in the browser. You shouldn't include script.js .
Read more >source-map-support - npm
Source Map Support. Build Status. This module provides source map support for stack traces in node via the V8 stack trace API.
Read more >Browserify
Browserify lets you require('modules') in the browser by bundling up all of your dependencies. Install Documentation · Source Code · Help + Articles...
Read more >API - esbuild
This API call is used by the command-line interface if no input files are provided and the --bundle flag is not present. In...
Read more >A Gentle Browserify Walkthrough - Ponyfoo
bar.js console.log(i); // <- ReferenceError: i is not defined ... when it comes to using CommonJS in the browser through Browserify.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After adding
stacktrace-js
as an dependency to package.json and adding the following line to my entrypoint it worked for me:Hmm. I got it. You’re right!
But installing the module with npm will cause this error on any app, since that
node_modules
normally isn’t present on Client Apps when it is deployed to production.Normallly packages installed by npm are used with AMD, CommonJS, etc. (using ES6 or no)
So the solution is provide the JS module architecture, as mentioned in #2
I guess I can do it in my free time.