-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected token export when using prerenderUrls #1662
Comments
Yes, you have to use CJS as our examples show. If you need to import external values into your // prerender-urls.js
module.exports = async function () {
const { default: fooUrl } = await import('./foo.mjs');
return [
{
url: '/',
title: 'Homepage',
},
{
url: fooUrl,
}
]
} // foo.mjs
export default '/foo-url'; |
Okay, I see, thanks. Is there really no way of importing TS files then? Maybe having a command to transpile the TS before running |
Sure, you certainly can transpile that yourself with TSC or Babel (or any number of other tools). It's just not something we will do automatically for you. I'd recommend just using JSDoc if you really can't live without types in those files though. Transpiling for that small use case sounds like more of a pain than it's worth. JSDoc works just as well. FWIW I'm not against TS config files, so maybe I'll take a look and see if this can be easily added. We also do allow for CJS and ESM in the config file ( |
Hello, today I tried using the
--prerenderUrls
tag with a.js
file in a TypeScript project.. I need some dynamic props in myprerender-urls
file, which means I also imported some other files in it, and then usingexport default
of the function with the array of props that I need, but I getUnexpected token export
.. When I try usingmodule.exports = ...
I then again have issues about my imports since they're.ts
files.. Is there any way to accomplish what I am doing?The text was updated successfully, but these errors were encountered: