New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
"process is not defined", when using Typescript (MRE included) #9643
Comments
quick note: I've been able to workaround this issue in my TS-based project (https://github.com/npmgraph/npmgraph) by creating a small JS module that just exports the necessary env-var, and importing that into my TS code: // file: "bugsnag_key.js"
const BUGSNAG_KEY = process.env.BUGSNAG_KEY;
export default BUGSNAG_KEY; I should also note that this code was working fine until I updated a slew of the project's dependencies. 'Not sure what changed that caused this to break. |
More breadcrumbs ... Removing the window.onload = function () {
// @ts-ignore (so TSC doesn't complain. :-( )
document.body.innerHTML = process.env.BUGSNAG_KEY;
} I'm going to leave this open, as being able to properly declare the shape of |
馃悰 bug report
parcel@latest
process.env
for it to work properly. :-)馃帥 Configuration (.babelrc, package.json, cli command)
See attached MRE and envinfo, below
馃 Expected Behavior
In the attached MRE, you should see the value of
process.env.BUGSNAG_KEY
("00000000000000000000000000000000 " as defined in.env
file) in the browser.馃槸 Current Behavior
The browser is blank because the script throws (as seen in the console) this:
馃捇 Code Sample
To reproduce this issue:
cd parcel_process_bug
npm install && npm start
parcel
happens to be running on)Notice: The page is blank page. In the dev tools console you'll see the error described above.
Furthermore... In
index.html
, if you change "index.ts" to "index.js" (i.e. circumvent the need for TS compilation), it works as expected.馃實 Your Environment
The text was updated successfully, but these errors were encountered: