Skip to content
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

Pages config is not injected when generators using with typescript #28

Closed
bicstone opened this issue Sep 27, 2022 · 3 comments · Fixed by #43
Closed

Pages config is not injected when generators using with typescript #28

bicstone opened this issue Sep 27, 2022 · 3 comments · Fixed by #43

Comments

@bicstone
Copy link

bicstone commented Sep 27, 2022

Pages config is not injected when using gatsby-config.ts.
Gatsby will ignore pathPrefix and build the site as if hosted from the root domain.

To Reproduce

  1. Create Gatsby Project with TypeScript
  2. Add deploy action from template
  3. Run Workflow

Run actions/configure-pages@v2

Using default blank configuration
Injecting property=pathPrefix and value=/temp-gatsby-starter-ts/ in:
// Default Pages configuration for Gatsby
module.exports = {}

Found configuration object in direct module export
Injection successful, new configuration:
// Default Pages configuration for Gatsby
module.exports = {pathPrefix: "/temp-gatsby-starter-ts/"}

Injecting property=siteMetadata.siteUrl and value=https://bicstone.github.io/ in:
// Default Pages configuration for Gatsby
module.exports = {pathPrefix: "/temp-gatsby-starter-ts/"}

Found configuration object in direct module export
Injection successful, new configuration:
// Default Pages configuration for Gatsby
module.exports = {siteMetadata: {siteUrl: "https://bicstone.github.io/"},pathPrefix: "/temp-gatsby-starter-ts/"}

Gatsby will ignore pathPrefix and build the site as if hosted from the root domain

https://bicstone.github.io/temp-gatsby-starter-ts/

@bicstone
Copy link
Author

bicstone commented Sep 27, 2022

I tried adding the generator_config_file: './gatsby-config.ts' option but it did not work.

Run actions/configure-pages@v2

Injecting property=pathPrefix and value=/temp-gatsby-starter-ts/ in:
import type { GatsbyConfig } from 'gatsby';

const config: GatsbyConfig = {
  // Since `gatsby-plugin-typescript` is automatically included in Gatsby you
  // don't need to define it here (just if you need to change the options)
  plugins: [],
  jsxRuntime: `automatic`,
};

export default config;

Warning: We were unable to determine how to inject the site metadata into your config. Generated URLs may be incorrect. The base URL for this site should be [https://bicstone.github.io/temp-gatsby-starter-ts/.](https://bicstone.github.io/temp-gatsby-starter-ts/) Please ensure your framework is configured to generate relative links appropriately.

@yoannchaudet
Copy link
Collaborator

👋 actions/configure-pages does not support or understand TypeScript today. And it is really hard to support all the things when a language parser is required.

You probably want to configure Pages manually yourself in this case since you are a bit out of the "default" paths.

@bicstone
Copy link
Author

bicstone commented Sep 28, 2022

Thank you for your reply!
gatsby-config.ts is configured in the Gatsby official starter, although it is out of the default.
https://github.com/gatsbyjs/gatsby/tree/gatsby%404.24.0/starters/gatsby-starter-minimal-ts

It would be nice if you could be able to warn that extensions other than .js, .cjs, .mjs are not supported if specified in generator_config_file.

@bicstone bicstone changed the title [Gatsby] Pages config is not injected when using Gatsby with typescript Pages config is not injected when generator using with typescript Oct 1, 2022
@bicstone bicstone changed the title Pages config is not injected when generator using with typescript Pages config is not injected when generators using with typescript Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants