Make RescopeGlobalSymbols usable in a node environment
See original GitHub issueI’m using the RescopeGlobalSymbols
compiler pass via the options.setRenamePrefixNamespace
compiler option in shadow-cljs
. This works great for Browser-targetted builds but node.js
targetted builds break since the compiler is rewriting all of the node “specials”.
module.exports -> window.module.exports
require("foo") -> (0,window.require)("foo")
global -> window.global
This could be fixed by either making SPECIAL_EXTERNS
configurable or just including the node-specific globals by default.
Happy to open a PR for this just wanted to check in first about the preferred way.
The added externs would be global, process, require, module, exports, __filename, __dirname
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Working with Environment Variables in Node.js - Twilio
Environment variables are a great way to configure parts of your Node.js application. Learn how to work with them using helpful tools such ......
Read more >Setting up a Node development environment - MDN Web Docs
You now have a Node development environment up and running on your computer that can be used for creating Express web applications.
Read more >Setting Environment Variables for Node to retrieve
process.env.TEST is now usable in node. Env-files are a good way of keeping api-keys out of your codebase. B) Use Powershell - this...
Read more >How to (easily) set up Node environment variables in your JS ...
Step 1: .gitignore. We're going to add the variables to a file we make called simply .env , but before we do, let's...
Read more >How To Create a Node.js Module - DigitalOcean
You will need Node.js and npm installed on your development environment. This tutorial uses version 10.17.0. To install this on macOS or Ubuntu ......
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
@thheller I think your suggestion is a reasonable one, but I’m not personally familiar with this pass, so I could be wrong.
We’re unlikely to work directly on this ourselves anytime soon, but if you’re willing to create a PR we can review it and merge it if it seems safe to do so.
This was fixed in https://github.com/google/closure-compiler/commit/5bdbce93916f02e268d8d0223023b0853984aba1 and available since release
v20190121
.