Closed SheaBelsky closed 2 years ago
Looks like this is similar to the issue described in: https://github.com/blitz-js/babel-plugin-superjson-next/issues/76#issuecomment-866179513
I tried:
node_modules
.next
superjson-next
to babel-plugin-superjson-next
in babel.config.js
My babel.config.js
:
module.exports = {
"plugins": [
"babel-plugin-transform-typescript-metadata",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-transform-modules-commonjs",
"babel-plugin-superjson-next",
],
"presets": [
"next/babel"
]
}
My tsconfig.json
{
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": [
"dom",
"dom.iterable",
"esnext",
"ESNext.AsyncIterable"
],
"module": "commonjs",
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": false,
"target": "ES2020",
},
"exclude": [
"node_modules"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
}
Hi @SheaBelsky! I'd love to look into this. Can you provide a reproduction repository for this case? I suspect this is caused by specific syntax in one of your page files, that babel-plugin-superjson-next has trouble picking up at the moment.
@Skn0tt Working on a reproduction repo now, will post here when it's done!
@Skn0tt I was able to identify a way to consistently reproduce the error in a minimally viable repo:
There seems to be an error when using getServerSideProps
in a component that uses the export {default} from
syntax. Took me a while to figure out the culprit, but I can fix the error by importing the component manually and then re-exporting it. Please let me know if this is what you needed!
Thanks, that's super helpful! Will take a look at it later this week.
"Later this week" came earlier than expected. Wanna take a look at the PR @SheaBelsky?
I'm trying to implement this library in a project that would pass down date objects within a deeply nested object.
For example:
If I have data in this shape, the plugin does not seem to catch the dates and convert them. Is this working as designed? Are there plans to address this in the future, or is this considered out of scope for this library?