standard-things / esm

Tomorrow's ECMAScript modules today!
Other
5.27k stars 147 forks source link

ReferenceError with 3.2.22 #772

Closed daveisfera closed 5 years ago

daveisfera commented 5 years ago

I was testing 3.2.22 to see if it changed anything in regards to #729 and it ran into a different issue earlier in our tests. Here's the error output for what should be a valid require:

/usr/src/app/lib/core/lib/TransformationsValidate.js:3
const { validate } = require('./FormulaValidate');

ReferenceError: validate is not defined 
    at Object.<anonymous> (/usr/src/app/lib/core/lib/TransformationsValidate.js:3:22)
    at Generator.next (<anonymous>)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)

Any other info that I can provide to help in regards to this issue?

jdalton commented 5 years ago

Hi @daveisfera!

As with the other issue a small repro is needed for me to dig into it. Are you using proxyquire as with #729?

GrayStrider commented 5 years ago

Hey, this freaked me out and a relative newbie.

I'm playing with CreateReactApp, and after yarn install, which apparently updated several other packages, I started getting the same error, but in env.js - "dotenv is not definied", const dotenvFiles = [ ${paths.dotenv}.${NODE_ENV}.local,,

module.exports = { dotenv: resolveApp('.env'),.

I'm not using .env file at all

I tried several revisions and tracked issue down to the commit when I swtiched to esm. So I downgraded to 3.3.20 and everytning works again now.

What I'm getting from this incident is I should set static versions for all my packages asap lol, and update manually

daveisfera commented 5 years ago

I'll see if I can make a reproducer, but I'm not use proxyquire in the test that this is failing on.

jdalton commented 5 years ago

Any luck creating a repro @daveisfera?

Update:

I believe this is fixed by https://github.com/standard-things/esm/commit/a48ba8a8a9bfcd62e4309222dcc2f217200a1f34.