Open jaydenseric opened 4 years ago
Another few things to support Node.js ESM:
styled-jsx/css.mjs
file that throws relevant errors about transpilation having not worked. Having a file there with default and named exports also prevents ESLint plugins from complaining what you import doesn’t resolve.import
specifiers don't have file extensions.In the latest release we introduced this option https://github.com/zeit/styled-jsx#stylemodule Could it be a solution to this issue?
Nope.
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
The
styled-jsx/babel
Babel plugin is incompatible with Node.js ESM in two ways, relating to mandatory file extensions:styled-jsx
deep imports, e.g.import css from 'styled-jsx/css'
works butimport css from 'styled-jsx/css.js'
doesn't.import _JSXStyle from 'styled-jsx/style'
.If the current behavior is a bug, please provide the steps to reproduce and possibly a minimal demo or testcase in the form of a Next.js app, CodeSandbox URL or similar
For the first issue:
In
demo-1.mjs
:Try to transpile that file with the
styled-jsx/babel
Babel plugin, and note that it did not do any transformations.For the second issue:
In a project with
styled-jsx
installed, indemo-2.mjs
:Run with a current Node.js version (e.g. v14.2):
And note the crash:
What is the expected behavior?
The
styled-jsx/babel
Babel plugin should expect, and produce, ESM compatible with Node.js.Environment (include versions)
Did this work in previous versions?
Doubt it.