SyntaxError: Unexpected token - when requiring sheetify in a file using JSX
See original GitHub issueI’m trying to use sheetify in a module that is using JSX syntax:
const { h } = require('preact');
const css = require('sheetify');
const styles = css`:host { color: hotpink; }`;
const HelloThing = () => (
<h1 class={styles}>Hello!</h1>
);
module.exports = HelloThing;
This gives me:
SyntaxError: Unexpected token (7:2) while parsing file: whatevs.js
My browserify setup in package.json looks like:
"transform": [
[
"sheetify/transform",
{
"use": [
[
"sheetify-postcss",
{
"plugins": [
"postcss-cssnext"
]
}
]
]
}
],
"babelify"
]
},
Reading #49 makes me think it should work, but apparently it doesn’t. Any idea or hint on how this could work?
Edit: i’m running up-to-date browserify@14 / budo@10
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
ReactJS: "Uncaught SyntaxError: Unexpected token <"
However, when I tried to put my JS in a separate file, I started getting this error: "Uncaught SyntaxError: Unexpected token <". I...
Read more >Parsing files with React's JSX in *.js files throws SyntaxError ...
Parsing files with React's JSX in *.js files throws SyntaxError: Unexpected token ... const gqlPluck = require('graphql-tag-pluck').default; ...
Read more >Unexpected token < in JSON at position 0 - Dave Ceddia
Unhandled Rejection (SyntaxError): Unexpected token < in JSON at position 0. You made an HTTP request, probably with Fetch, and it blew up ......
Read more >JavaScript Error Handling: Unexpected Token - GeeksforGeeks
An unexpected token occurs if JavaScript code has a missing or extra character { like, ) + – var if-else var etc}. Unexpected...
Read more >Uncaught SyntaxError: Unexpected token '<' (at app.js:12:12)
Uncaught SyntaxError: Unexpected token '<' (at app.js:12:12). my app.js file. import React from 'react'. import { render } from 'react-dom'.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That sounds reasonable. I think I should find the time next week to give this a try if that’s ok. I’ll let you know what comes out of it.
Works like a charm!