Open jking6884 opened 2 years ago
The 2.0 upgrade guide links to this cheat sheet of ways to polyfill node features in the current version of webpack. You could do that. The example at the very bottom matches your use case (rewriting process.env.SOMETHING
).
That said, getting all of babel to load into the browser this way is definitely an adventure. You will probably hit other problems behind this one. Babel's own suggestion for this use case is to use the @babel/standalone
package instead.
@ef4 Thanks for your response.
I am using @babel/standalone in my project right now. I was also able to get @babel/parser installed and working successfully, as I want to be able to parse an AST from code. I also want to be able to generate code from an AST. My understanding was that in order to do that I needed to use @babel/generator. Is that a correct understanding? I don't think @babel/standalone includes parse or generate functionality.
My project is on Ember 3.24 and it seems it is ember-auto-import is resolving to 1.12.0. I'll upgrade to latest.
@ef4 What file is this supposed to be done in? I added it in the addon's index.js file (2nd screenshot below) but it didn't have any effect.
Oh, I see. It needs to be inside of the ember-auto-import
block. That seems to be working for process.env.SOMETHING
now.
I am running into this issue when trying to import @babel/generator.
This is the error in the console.
This is the line of code that is causing the issue.
I know that process is not available outside of the node context, but I was curious because surely many node apps make this reference, so I figured there might be some way to address this. Or perhaps not.