Microbundle: Error: Plugin 'jsx' not found

Created on 30 Jan 2018  ยท  16Comments  ยท  Source: developit/microbundle

Hi there, I was super excited to find this project. Unfortunately, I can't get it working. I end up getting this error whenever I do anything:

$ npm run prepare
> [email protected] prepare /Users/aaronjensen/Source/react-multicast
> microbundle

Error: Plugin 'jsx' not found

Here's my repro repo: https://github.com/substantial/react-multicast (checkout branch repro)

Maybe I'm just doing something wrong?

bug help wanted upstream

Most helpful comment

I was able to fix this by deleting package-lock.json, node_modules, karmatic and using yarn....

All 16 comments

I was able to fix this by deleting package-lock.json, node_modules, karmatic and using yarn....

Hmm. Hitting this too, on windows.

Seems like it happens after upgrading beyond 0.2.

I assume this is the

          nodent({
            exclude: 'node_modules/**',
            noRuntime: true,
            promises: true,
            transformations: {
              forOf: false
            },
            parser: {
              plugins: {
                jsx: require('acorn-jsx')
              }
            }
          }),

code.

I've been trying to find a fix for this for a while. If anyone has tips, post them here!

~Just occurred after cloning and running npm install. It seems to be karmatic fault. I'm going to dig a little more.~ no. it's not karmatic specific. Sorry. I'm going deeper =P

I've just expended some time debugging and now I got it right: here's the problem:

Acorn diverges versions across dependencies. It generally isn't really a problem, but the way plugins are stored at runtime makes it a problem. At the point of the Not Found exception, there were 3 different acorn.js loaded (acorn's main file points to /dist/acorn.js, compiled from source before publishing). As each time they are loaded, the currently available plugins are "rewritten" we lost our jsx in the way.

[1] "Rewritten" not entirely true: the variable isn't rewritten, but the Parsers instantiated by each version won't have access to the plugins injected into another version.

Here follows karmatic npm ls result with the relevant part.

[email protected] /Users/edygar.oliveira/dev/karmatic
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚ โ”‚   โ””โ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚   โ””โ”€โ”ฌ [email protected]
โ”‚     โ””โ”€โ”ฌ [email protected]
โ”‚       โ””โ”€โ”€ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚ โ”‚   โ”œโ”€โ”€ [email protected]
โ”‚ โ”‚   โ””โ”€โ”ฌ [email protected]
โ”‚ โ”‚     โ””โ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”ฌ [email protected] (github:developit/rollup-plugin-nodent#558eacf39d84980f63fd8737e35bff241dabc944)
โ”‚   โ”œโ”€โ”ฌ [email protected]
โ”‚   โ”‚ โ””โ”€โ”€ [email protected]
โ”‚   โ””โ”€โ”ฌ [email protected]
โ”‚     โ””โ”€โ”€ [email protected] deduped
โ””โ”€โ”ฌ [email protected]
  โ”œโ”€โ”€ [email protected]
  โ””โ”€โ”ฌ [email protected]
    โ””โ”€โ”€ [email protected]

I've been toying with the versions trying to get plugin injection to work consistently for a bit, and I don't have a perfect solution yet.

Switching to yarn fixed this for me, which seems silly.

I also had to switch to yarn to fix this problem

@edygarOliveira can confirm. The issue is caused by a breaking change in the plugin system for acorn 6. Following the chain of our dependencies the one breaking is the rollup-plugin-nodent which in turn is built on top of nodent. The latter hasn't been updated to v6 yet.

Created an issue there but it seems like the work required is too much effort and that it won't be updated anytime soon.

For now it seems like removing nodent from our dependencies sounds like the best option.

This error went away for me after deleting node_modules and upgrading from 0.6.0 to 0.7.0 (not using yarn) ยฏ_(ใƒ„)_/ยฏ

Edit: This came back when the package-lock was modified by someone else on the project so I guess it's dependent on npm version?

FYI: I have a fix for this ready. Just need to clean up the commits a bit, but I have a solution in place. Hopefully the PR will be ready this weekend.

Oh, nice

I feel the real fix might be to get the babel pr done

@ForsakenHarmony That's what I basically did. I replaced bublรฉ and nodent with babel + babel-plugins.

Did you continue the pr that's open, or just from scratch?

To be honest I didn't look at the existing PRs at all :/ I'll check if it makes sense to build on the existing Babel one

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SleeplessByte picture SleeplessByte  ยท  3Comments

rdmurphy picture rdmurphy  ยท  3Comments

bitttttten picture bitttttten  ยท  4Comments

sptimer picture sptimer  ยท  4Comments

cowboyd picture cowboyd  ยท  3Comments