question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

question: getting error process not defined in angular 2

See original GitHub issue

hello. Im trying to figure out how to use this package on our application but for some reason im getting an error process not defined

im trying to use it this way. this is just test run.

import browserslist from "browserslist";
console.log(browerslist(`last 2 #{currentBrowser} versions`));

what we’re trying to do is query the last 2 stable versions.

we also have this on our package.json

"browserslist": [
    "last 2 chrome versions",
    "last 2 firefox versions",
    "last 2 safari versions"
  ],

How do you use this? some weird answer that I get on SO was to run this on node?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
aicommented, Feb 6, 2020

@artoodeeto sending Browserslist to the client is bad idea because of the client-side bundle size and it affect on performance.

Look at “Tools” section in our docs. We have a few good alternatives, which work with User Agent. I recommend server-side solutions like browserslist-useragent-ruby. But if can’t do it with server-side code, you can use browserslist-useragent-regexp which will compile your Browserslist config to RegExp for User Agent.

Does it fit your task?

1reaction
aicommented, Feb 6, 2020

Do you think this will have the same effect on us bundle size wise?

Yes. According to bundlephobia adding caniuse-api to your client-side bundle will add 500 KB of JS to your bundle.

I recommend using bundlephobia before adding any new library to your project. Also, there is nice extension for text editors to show the cost of your libraries.

Also Size Limit is a great tool for CI to warn you about unexpected bundle size increases.

so basically they’re using your package to query browser.

Note that last 1 version doesn’t tell you current user browser. It gives you just latest released versions according to Can I Use.

My question is, is this data reliable? Can I expect it to be this way always?

Yes, it is always NAME SPACE VERSION format.


If you like our support consider talking with your manager about funding our security refactoring.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 6 - process is not defined when trying to serve ...
Since process is not globally defined in the browser, execution of this line fails when running as Angular app. This type of error...
Read more >
process is not defined error with angular 12 [Bug] #284 - GitHub
The intent behind performing such a hack is for us to be able to avoid a browser/DOM exception when the browser tries to...
Read more >
process is not defined , Angular 12,13 Error Fixed. - YouTube
Uncaught ReferenceError: process is not defined , Angular 12,13, Easy fix --Add this below line in the " polyfills.ts " files to fix...
Read more >
ReferenceError: "x" is not defined - JavaScript - MDN Web Docs
ReferenceError: "x" is not defined. The JavaScript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
Read more >
3 Ways to Solve jQuery - Uncaught ReferenceError: $ is not ...
If you are using jQuery, Angular JS, or plain old JavaScript and getting "Uncaught ReferenceError: $ is not defined" error which means $...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found