facebook / stylex

StyleX is the styling system for ambitious user interfaces.
https://stylexjs.com
MIT License
8.21k stars 304 forks source link

esbuild plugin has undeclared dependency on babel-plugin-syntax-hermes-parser #576

Closed welkup closed 1 month ago

welkup commented 1 month ago

Describe the issue

The esbuild plugin's index.js file imports from 'babel-plugin-syntax-hermes-parser', but the esbuild plugin does not declare this dependency in its package.json. This results in the following error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'babel-plugin-syntax-hermes-parser' imported from //node_modules/@stylexjs/esbuild-plugin/lib/index.js at new NodeError (node:internal/errors:405:5) at packageResolve (node:internal/modules/esm/resolve:782:9) at moduleResolve (node:internal/modules/esm/resolve:831:20) at defaultResolve (node:internal/modules/esm/resolve:1036:11) at DefaultModuleLoader.resolve (node:internal/modules/esm/loader:251:12) at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:140:32) at ModuleWrap. (node:internal/modules/esm/module_job:76:33) at link (node:internal/modules/esm/module_job:75:36) { code: 'ERR_MODULE_NOT_FOUND' }

Expected behavior

The esbuild plugin should run without the need to install the babel-plugin-syntax-hermes-parser as a direct dependency of the application.

Steps to reproduce

  1. git clone https://github.com/facebook/stylex.git
  2. mv stylex/apps/esbuild-example/ .
  3. cd esbuild-example
  4. npm i
  5. npm run build

Test case

No response

Additional comments

Can work around by installing the hermes parser as a dependency of your main app.