weaveworks / ui-components

A collection of UI components that are shared across Weaveworks projects
http://weaveworks-ui-components.s3-website-us-west-2.amazonaws.com/
Apache License 2.0
30 stars 26 forks source link

Files without JSX are not transpiled by babel #38

Open jpellizzari opened 6 years ago

jpellizzari commented 6 years ago

Repro:

  1. Add a new file that doesn't use JSX:
    
    import styled from 'styled-components'

export const SomeComponent = styled.divfont-size: 24px;;


2. Try to load the docs page. 
3. Fails with `Uncaught SyntaxError: Unexpected token import`
4. Add in some JSX to the file and it works fine.

This is probably due to dynamically building the page with hot reloading and tricky webpack context stuff (see `/docs/Root.js`). This would be the first time this was caught because all other components that are shown have JSX in them. 

Current workaround is to include JSX in the file.
jpellizzari commented 6 years ago

https://github.com/babel/babel-loader/issues/293