Replies: 2 comments
-
Hey @ssyberg — thanks for the issue! Our But your proposed fix is actually similar to what we have documented in our changelog for that version - maybe there is some further clarity I can add there though. Theoretically, you just need some type of transpiler for your Payload config. There are many ways to do this, but using However, if you don't want to use
const swcRegister = require('@swc/register');
swcRegister({
sourceMaps: 'inline',
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
},
module: {
type: 'commonjs',
},
});
const payloadConfig = require('./path-to-your-real-config.js');
module.exports = payloadConfig; Basically, a package like But, this would allow you to use full JS without any TS at all. And I should also note that even this is completely optional for you, and is only required if you want to use JSX or TS directly in your Payload config. Does this clear things up? Because there is nothing super actionable that we can do here, I will convert this into a discussion but am happy to keep conversation going there. Are you up and running successfully again? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the thorough response! Just to clarify, besides not allowing you to incrementally introduce TS (for some client projects this is just not something that will ever be in the cards), can you think of any other downsides to this approach?
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Report
When upgrading a non-typescript payload project to 1.6.1
yarn dev
fails withSyntaxError: Cannot use import statement outside a module
.Though this is alluded to in the "Breaking Changes" in the CHANGELOG it is unclear what the path is for javascript based projects that do not want to use typescript (and are not interested in a path to typescript integration in the future). The only recommendation is to spin up a TS project and implement workarounds to continue using JS (I've successfully used a TS install this but this requires significant use of
@ts-ignore
).Relatedly,
npx create-payload-app
results in a non-functional project when choosingjavascript
.Steps to Reproduce
yarn upgrade [email protected]
yarn dev
Proposed Fix
The fix for this was simply to (1) rename
payload.config.ts
topayload.config.js
and update internal references and (2) switch fromts-node
tonode
in theyarn serve
definition. This process should be documented (and someone who knows the codebase better than I do should confirm this is sufficient). Further,create-payload-app
should be updated to reflect these changes as well.Beta Was this translation helpful? Give feedback.
All reactions