bublejs / buble

https://buble.surge.sh
MIT License
871 stars 67 forks source link

TypeError: acorn__WEBPACK_IMPORTED_MODULE_2__.Parser.extend is not a function #189

Closed davixyz closed 5 years ago

davixyz commented 5 years ago

I'm coming from this repo: https://github.com/pedronauck/docz Which has a dependency tree like this

└─┬ docz-theme-default@0.13.7
  └─┬ react-live@1.12.0
    └── buble@0.19.7  deduped

Seems that bubble@0.19.7 introduced an issue with this: TypeError: acorn__WEBPACK_IMPORTED_MODULE_2__.Parser.extend is not a function

If we lock to bubble@0.19.6 everything works again. Any insight?

adrianheine commented 5 years ago

Thanks for the report! Can you link to a small example reproducing this issue? I tried the basic example from docz, but couldn't get it to work at all for me.

davixyz commented 5 years ago

Hi @adrianheine Here's the repo with the issue: https://github.com/davixyz/docz-issue

Basically seems that theme-default is depending on react-live, which is depending on buble and latest version is breaking. Seems to work again when I lock buble@0.19.6

adrianheine commented 5 years ago

Thanks, I can reproduce the issue by cloning your repo, running npm i && npm run dev and then opening the served page in my browser. I'll have a look.

adrianheine commented 5 years ago

Hm, acorn__WEBPACK_IMPORTED_MODULE_2__ is acorn@5.7.3, but bublé depends on acorn@6. Apparently, npm did set up the dependencies correctly, since echo "const x = 1" | node_modules/.bin/buble works (I can see an acorn@6.1.1 in node_modules/buble/node_modules, too). So, on the server-side, everything seems to be correctly set-up, but somehow webpack bundles bublé with the wrong acorn version.

It's obvious that buble@0.19.6 doesn't have this issue since I temporarily bundled acorn in the bublé package in that version. buble@0.19.5 also depends on an external acorn@6, so that doesn't work either, and buble@0.19.4 uses the old acorn@5, so that works with the acorn version webpack bundles it with.

I suggest to open corresponding issues with webpack (since it is doing the wrong bundling) and react-live (since it is the package depending on bublé). Further, it makes sense to update all dependencies on acorn@5, since that's a safe way to fix this issue for you and also a good thing to do for everyone. Currently, art-template@4.13.2 (via docz-core@0.13.7 via docz@0.13.7) and webpack@4.28.4 (this can be solved by upgrading to webpack@4.29.6) pull in acorn@5.

davixyz commented 5 years ago

If the issue is not here, we can close this.