johanholmerin / style9

CSS-in-JS compiler inspired by Meta's stylex
MIT License
570 stars 27 forks source link

Use CommonJS in index.js #72

Closed amsardesai closed 2 years ago

amsardesai commented 2 years ago

Context: I'm trying to use style9 in a project where front-end code gets rendered on a node server (i.e for server side rendering). Whenever I do this, I get the following error:

.../node_modules/style9/index.js:28
export default function style9(...styles) {
^^^^^^
SyntaxError: Unexpected token 'export'

Node doesn't recognize the import/export syntax in this file because there is no "type: module" declaration in the package.json.

This PR fixes the issue by using the CommonJS syntax in index.js, so that the module is parseable by node.

johanholmerin commented 2 years ago

Fixed in 0.14.0