Export transpiled components
- Currently we publish PubSweet packages to npm as ES6/Next/JSX. These need to be passed through Babel before hitting the browser.
- But we don't want to pass all dependencies through babel because it's slow and some packages actually break due to
devDependenciesnot being installed.
- So we craft elaborate regular expressions to match some packages and exclude others. This has lots of problems: pubsweet-starter!31 (merged), xpub/xpub!134 (merged), pubsweet-starter#9 (closed)
- These regular expressions must be duplicated in most components' Jest configs too otherwise
babel-jestwill not transpile dependencies and unit tests will fail.
- It means that the babel config of each app is dependent on the babel config of every untranspiled dependency it consumes. i.e. if a component wants to add a babel plugin for a particular feature it is a breaking change as the plugin must be added to the app too (and the same applies to tests that require the component).
See below for possible partial solutions.