webcompat / webcompat-reporter-extensions

Browser extensions to help report site compatibilty issues.
26 stars 21 forks source link

Fixes #135 - Update webpack-cli to v3 #137

Closed laghee closed 5 years ago

laghee commented 5 years ago

Webpack v4.20 exposed a CLI issue (some call to read a property of a potentially undefined object), and their official suggested fix was to update webpack-cli to v3.1.1.

laghee commented 5 years ago

Well, that's weird. This just started happening (the last PR tests a half hour ago ran fine), and I'm not sure why. It started happening for me locally, too, on all branches including master, but was resolved by running rm -rf node_modules and re-running npm install... So I'm guessing this has to do with the line in the Travis config that caches the node_modules dir: https://github.com/webcompat/webcompat-reporter-extensions/blob/bb47dccb46df1bc557f6b3bcdaca8b17c3c09d11/.travis.yml#L12

@miketaylr Maybe if we dump the cache on Travis, it'll fix it?? 🤔

miketaylr commented 5 years ago

@miketaylr Maybe if we dump the cache on Travis, it'll fix it?? 🤔

I just deleted the cache and restarted Travis.

(Aside, you should have access to do the same, IMO -- if you don't let's figure out what we need to do to give you admin access in travis)

miketaylr commented 5 years ago

Hmm...

(ノಠ益ಠ)ノ彡┻━┻
ReferenceError: Unknown plugin "transform-es2015-modules-commonjs" specified in "/home/travis/build/webcompat/webcompat-reporter-extensions/.babelrc" at 0, attempted to resolve relative to "/home/travis/build/webcompat/webcompat-reporter-extensions"
  at tryModuleLoad  <internal/modules/cjs/loader.js:538:12>
laghee commented 5 years ago

Wut... still? So clearing the cache doesn't work. Interesting. I'll muck around and see what I can figure out.

mbuotidem commented 5 years ago

My bad, I should have filed a bug for this 'ReferenceError' thing because I totally encountered it too. I made the screenshots and saved the log file but then forgot to haha. I also did some googling at the time and stumbled on a thread that might help: https://github.com/babel/babel/issues/3969#issuecomment-286961125

miketaylr commented 5 years ago

Wait, I'm confused.

https://babeljs.io/docs/en/babel-plugin-transform-es2015-modules-commonjs

We don't even have that in our package.json. Why do we have a .babelrc @laghee?

laghee commented 5 years ago

@miketaylr It's how I made intern play nice with nodejs and es6 -- I can't remember where I found the advice now, but it worked like a charm at the time (and until the other day). I think it was a built-in babel plugin, maybe? (Is a "built-in plugin" a thing?) Looking now, I can't find it anywhere in the babel directories, though. Maybe a babel update eliminated it?

I have this vague memory that the way that webpack resolves file paths conflicts with the way intern does, so to avoid mapping 300 different dependencies in the intern config, I chose to make a .babelrc as an easier alternative. I'm not 100% sure that's correct, but that's my best off-the-top-of-my-head response. I'm guessing you probably asked me why at the time, so I'll go see if I can find that conversation in here somewhere... (guess not)

If I strike out on that, I'll see what specifically changed with webpack-cli v3 that might have sent everything all kablooey 💣 .

laghee commented 5 years ago

OK, so if I install babel-plugin-transform-es2015-modules-commonjs (looks like the name changed, at any rate) directly, then everything works fine. Let's see if Travis agrees...

Huh. Well, I have no idea how this was magically working before now, but... yay, it works again? Didn't see anything immediately obvious in the changelog for webpack-cli, but I found this, which seems interesting.

miketaylr commented 5 years ago

Sweet, thanks @laghee!