Comments (4)
Thanks @ThaisRobba and @predragnikolic for reporting this and providing context!
Fixed it in #1564 and upgraded the CI jobs from Node 16 & 18 to Node 18 & 20.
Didn't supress the ExperimentalWarning
because I want us to stay aware that "Custom ESM Loaders is an experimental feature and might change at any time". In the meantime I subscribed to TypeStrong/ts-node#1997 so if a better solution for using ts-node
comes along we can switch to that.
from react-cosmos.
I have experienced the same issue.
λ react-cosmos main ✗ node -v
v20.5.0
λ react-cosmos main ✗ yarn -v
1.22.11
I tired made the following change in package.json
and it started working:
- "build": "ts-node --esm ./scripts/build.ts"
+ "build": "node --loader ts-node/esm ./scripts/build.ts"
Does this work for you?
from react-cosmos.
Not an expert,
but base on the docs https://github.com/TypeStrong/ts-node#commonjs-vs-native-ecmascript-modules
I would say ts-node --esm
, ts-node-esm
and node --loader ts-node/esm
can be used interchangeably, but I am not sure.
But on my setup, only node --loader ts-node/esm
will work in the build script.
the other two will throw the ERR_UNKNOWN_FILE_EXTENSION
error.
I tried to see what config does the ts-node command use, and here is the output of npx ts-node --showConfig
λ react-cosmos main ✗ npx ts-node --showConfig
{
"ts-node": {
"cwd": "/home/predragnikolic/Documents/sandbox/react-cosmos",
"projectSearchDir": "/home/predragnikolic/Documents/sandbox/react-cosmos",
"project": "/home/predragnikolic/Documents/sandbox/react-cosmos/tsconfig.json"
},
"compilerOptions": {
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"moduleResolution": "node10",
"newLine": "lf",
"noEmit": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"strict": true,
"target": "es2022",
"module": "es2022",
"sourceMap": true,
"inlineSourceMap": false,
"inlineSources": true,
"declaration": false,
"outDir": "./.ts-node"
}
}
notice "moduleResolution": "node10",
this line is not the same as the original line in tsconfig.json.
from react-cosmos.
Found the related issue on ts-node TypeStrong/ts-node#1997
from react-cosmos.
Related Issues (20)
- Setup of React Native not clear HOT 3
- Can't change webpack.output.publicPath via cosmos.webpack.js HOT 2
- Live demo is not working HOT 1
- The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it) HOT 5
- Increase awareness of the ability to override Webpack config HOT 1
- Webpack emits DefinePlugin warning on a fresh install with create-react-app HOT 2
- Unable to get started with vite plugin following the setup docs HOT 10
- Props tab show nothing when decorator for fixture not include `children` in response HOT 7
- Alert shows the wrong port number (minor) HOT 2
- Cosmos cannot find Vite configuration file with "ts" extension HOT 4
- Respect SSL option when connecting to websocket HOT 4
- fixture fails to enter fullscreen mode HOT 6
- Can't get cosmos to run with or without babel-loader or ts-loader HOT 4
- `cosmos --expose-imports` seems to have stopped building imports at some point HOT 3
- Cosmos.imports.ts isn't created nor updated on subsequent runs of npm run cosmos HOT 3
- Unable to use alias Preact in `next` branch HOT 9
- Fixture Error : Lazy element type must resolve to a class or function HOT 3
- Next.js 14 no longer allows 'use client' and generateStaticParams() to be used together HOT 3
- Does not show multi fixture with custom bundler (Parcel) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-cosmos.