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.

runtime-only build from CDN contain references to process.env.NODE_ENV - offer alternative build?

See original GitHub issue

I’m bundling my code only and using Vue from unpkg. But even if I’m not using the template option, I’m forced to use the standalone build because the runtime-only one has some node variables, like process or module.

Uncaught ReferenceError: process is not defined

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
nicolasparadacommented, Oct 15, 2016

@LinusBorg module.exports gave problems too… @posva Yeah, there is a couple of solutions, but… since they are on a CDN, they should be browser ready; with a minified version too.

1reaction
LinusBorgcommented, Oct 15, 2016

@NicolasParada As a fix, add a script tag that adds process.env.NODE_ENV to the global namespace:

<script>
  window.process = { env: { NODE_ENV: 'production' } }
</script>
<script src ="https://unpkg.com/vue@2.0.3/dist/vue.common.js" />

@fnlctrl I’m not sure weither these variables are supposed to be present in a build on a CDN. At least it’s inconvenient to offer CDN access to these files and then require a workaround like above to use them.

Think we should discuss internally how to deal with this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is process.env.NODE_ENV undefined? - Stack Overflow
process.env is a reference to your environment, so you have to set the variable there. To set an environment variable in Windows: SET...
Read more >
Working with Environment Variables in Node.js - Twilio
When your Node.js process boots up, it'll automatically provide access to all existing environment variables by creating an env object ...
Read more >
Handling runtime environment variables in create-react-apps
A new package called runtime-env-cra allows you to handle environment variables in quick and easy way with create-react-apps.
Read more >
Node Environment Variables: Process env Node
Node environment variables are strategies to define and consume environment-specific configurations and process env node. Learn how.
Read more >
Basic Features: Environment Variables - Next.js
Next.js has built-in support for loading environment variables from .env.local into ... This means that process.env is not a standard JavaScript object, ...
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