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

The action ignores .ts config and creates default nuxt.config.js #74

Open
Ni55aN opened this issue Mar 3, 2023 · 6 comments · May be fixed by #97
Open

The action ignores .ts config and creates default nuxt.config.js #74

Ni55aN opened this issue Mar 3, 2023 · 6 comments · May be fixed by #97

Comments

@Ni55aN
Copy link

Ni55aN commented Mar 3, 2023

This issue occurs when generator_config_file input is not provided

It may not be obvious when using Nuxt 3 Workflow suggested by Github. Additionally Nuxt 3 uses .js configuration file, even if a .ts config exists which makes it harder to debug this problem

Logs from the Action:

2023-03-03T23:28:19.0111047Z ##[group]Run actions/configure-pages@v3
2023-03-03T23:28:19.0111362Z with:
2023-03-03T23:28:19.0111649Z   static_site_generator: nuxt
2023-03-03T23:28:19.0112072Z   token: ***
2023-03-03T23:28:19.0112376Z   enablement: false
2023-03-03T23:28:19.0112643Z ##[endgroup]
2023-03-03T23:28:19.2606651Z Using default blank configuration
2023-03-03T23:28:19.2607688Z Injecting property=router.base and value=/retejs.org/ in:
2023-03-03T23:28:19.2608390Z // Default Pages configuration for Nuxt
2023-03-03T23:28:19.2608933Z export default {}
2023-03-03T23:28:19.2609265Z 
2023-03-03T23:28:19.2646922Z Found configuration object in direct default export declaration
2023-03-03T23:28:19.2647736Z Injection successful, new configuration:
2023-03-03T23:28:19.2648328Z // Default Pages configuration for Nuxt
2023-03-03T23:28:19.2648910Z export default {router: {base: "/retejs.org/"}}
2023-03-03T23:28:19.2649193Z 
2023-03-03T23:28:19.2649641Z Injecting property=target and value=static in:
2023-03-03T23:28:19.2650266Z // Default Pages configuration for Nuxt
2023-03-03T23:28:19.2651052Z export default {router: {base: "/retejs.org/"}}
2023-03-03T23:28:19.2651341Z 
2023-03-03T23:28:19.2662753Z Found configuration object in direct default export declaration
2023-03-03T23:28:19.2663623Z Injection successful, new configuration:
2023-03-03T23:28:19.2664196Z // Default Pages configuration for Nuxt
2023-03-03T23:28:19.2664771Z export default {target: "static",router: {base: "/retejs.org/"}}
2023-03-03T23:28:19.2665088Z 
2023-03-03T23:28:19.2785735Z ##[group]Run cat ./nuxt.config.ts
2023-03-03T23:28:19.2786080Z �[36;1mcat ./nuxt.config.ts�[0m
2023-03-03T23:28:19.2838925Z shell: /usr/bin/bash -e {0}
2023-03-03T23:28:19.2839234Z env:
2023-03-03T23:28:19.2839520Z   GITHUB_PAGES: true
2023-03-03T23:28:19.2839749Z ##[endgroup]
2023-03-03T23:28:19.2923229Z // https://v3.nuxtjs.org/api/configuration/nuxt.config
2023-03-03T23:28:19.2926664Z export default defineNuxtConfig({
2023-03-03T23:28:19.2926993Z   ssr: true,
2023-03-03T23:28:19.2927254Z   modules: [
......
2023-03-03T23:28:19.2934028Z     langDir: '/locales',
2023-03-03T23:28:19.2934299Z   },
2023-03-03T23:28:19.2934553Z });
2023-03-03T23:28:19.2995970Z ##[group]Run cat ./nuxt.config.js
2023-03-03T23:28:19.2996230Z �[36;1mcat ./nuxt.config.js�[0m
2023-03-03T23:28:19.3044971Z shell: /usr/bin/bash -e {0}
2023-03-03T23:28:19.3045175Z env:
2023-03-03T23:28:19.3045363Z   GITHUB_PAGES: true
2023-03-03T23:28:19.3045559Z ##[endgroup]
2023-03-03T23:28:19.3122664Z // Default Pages configuration for Nuxt
2023-03-03T23:28:19.3126129Z export default {target: "static",router: {base: "/retejs.org/"}}
@wvovaw
Copy link

wvovaw commented May 22, 2023

Same for me. It worked well with JS but it works wrong after I switched my app to typescript.
Here is details:

nuxt 3 with Typescript uses nuxt.config.ts file for configuration. But the action ignores it and creates a fallback one which leads to wrong output:

yarn run v1.22.19
$ nuxt generate
[log] Nuxi 3.5.0
[log] Nuxt 3.5.0 with Nitro 2.4.1
[warn] Using experimental payload extraction for full-static output. You can opt-out by setting `experimental.payloadExtraction` to `false`.
[info] Building client...
[info] vite v4.3.8 building for production...
[info] transforming...
[info] ✓ 119 modules transformed.
[info] rendering chunks...
[info] computing gzip size...
[info] .nuxt/dist/client/manifest.json                                  2.[7](https://github.com/wvovaw/wvovaw.github.io/actions/runs/5044766976/jobs/9048208083#step:8:8)9 kB │ gzip:  0.51 kB
[info] .nuxt/dist/client/_nuxt/error-500.aa16ed4d.css                   1.95 kB │ gzip:  0.74 kB
[info] .nuxt/dist/client/_nuxt/error-404.23f2309d.css                   3.63 kB │ gzip:  1.12 kB
[info] .nuxt/dist/client/_nuxt/_plugin-vue_export-helper.c27b6911.js    0.09 kB │ gzip:  0.10 kB
[info] .nuxt/dist/client/_nuxt/index.[8](https://github.com/wvovaw/wvovaw.github.io/actions/runs/5044766976/jobs/9048208083#step:8:9)3569895.js                        0.39 kB │ gzip:  0.29 kB
[info] .nuxt/dist/client/_nuxt/error-component.84e5e8b1.js              1.18 kB │ gzip:  0.64 kB
[info] .nuxt/dist/client/_nuxt/default.3a0d8000.js                      1.72 kB │ gzip:  0.98 kB
[info] .nuxt/dist/client/_nuxt/error-500.2b2ba75b.js                    1.93 kB │ gzip:  1.02 kB
[info] .nuxt/dist/client/_nuxt/error-404.5d70a75f.js                    2.31 kB │ gzip:  1.19 kB
[info] .nuxt/dist/client/_nuxt/nuxt-link.44b36c52.js                    4.32 kB │ gzip:  1.83 kB
[info] .nuxt/dist/client/_nuxt/entry.cad7fd5b.js                      139.32 kB │ gzip: 52.72 kB
[info] ✓ built in 2.46s
[success] Client built in 2467ms
[info] Building server...
[info] vite v4.3.8 building SSR bundle for production...
[info] transforming...
[info] ✓ 74 modules transformed.
[info] rendering chunks...
[info] .nuxt/dist/server/_nuxt/error-404-styles.a5c3f351.mjs           0.08 kB
[info] .nuxt/dist/server/_nuxt/error-500-styles.6b5b5ff2.mjs           0.08 kB
[info] .nuxt/dist/server/styles.mjs                                    0.35 kB
[info] .nuxt/dist/server/_nuxt/index-e12b288f.js                       0.22 kB │ map:  5.28 kB
[info] .nuxt/dist/server/_nuxt/_plugin-vue_export-helper-cc2b3d55.js   0.25 kB │ map:  0.13 kB
[info] .nuxt/dist/server/_nuxt/island-renderer-77ac9752.js             1.12 kB │ map:  1.42 kB
[info] .nuxt/dist/server/_nuxt/index-5c78600a.js                       1.24 kB │ map:  0.44 kB
[info] .nuxt/dist/server/_nuxt/error-component-fc2e7220.js             2.04 kB │ map:  2.71 kB
[info] .nuxt/dist/server/_nuxt/error-500-styles-1.mjs-0a86f27a.js      2.17 kB │ map:  0.12 kB
[info] .nuxt/dist/server/_nuxt/error-dev-styles-1.mjs-90bc7cbc.js      2.46 kB │ map:  0.12 kB
[info] .nuxt/dist/server/_nuxt/error-500-7bf32de6.js                   3.18 kB │ map:  3.79 kB
[info] .nuxt/dist/server/_nuxt/error-404-styles-1.mjs-6ef6e240.js      3.86 kB │ map:  0.12 kB
[info] .nuxt/dist/server/_nuxt/error-404-ddc98d1a.js                   4.07 kB │ map:  5.83 kB
[info] .nuxt/dist/server/_nuxt/default-5f629116.js                     4.67 kB │ map:  2.42 kB
[info] .nuxt/dist/server/_nuxt/nuxt-link-0d39ff03.js                   5.97 kB │ map: 13.18 kB
[info] .nuxt/dist/server/server.mjs                                   31.86 kB │ map: 74.74 kB
[info] ✓ built in 889ms
[success] Server built in 899ms
[success] [nitro] Generated public .output/public
[info] [nitro] Initializing prerenderer
[info] [nitro] Prerendering 3 initial routes with crawler
[log] [nitro]   ├─ / (48ms) (Error: [500] )
[log] [nitro]   ├─ /200.html (1ms)
[log] [nitro]   ├─ /404.html (1ms)
[success] You can now deploy `.output/public` to any static hosting!
Done in 6.6[9](https://github.com/wvovaw/wvovaw.github.io/actions/runs/5044766976/jobs/9048208083#step:8:10)s.

This output has no my code at all because of the fallback nuxt config created by the action.

I renamed the nuxt.config.ts to nuxt.config.js and the action worked as expected.

@wvovaw
Copy link

wvovaw commented May 22, 2023

Here nuxt config path is hardcoded to nuxt.config.js

@yoannchaudet
Copy link
Collaborator

This Action makes a best effort approach to update your configuration file. It only understands JavaScript and not TypeScript which is why we don't look at .ts files. While it may work for you, the minute you add TypeScript specific code in this file that our JavaScript parser does not recognize, it will blow up.

@Ni55aN
Copy link
Author

Ni55aN commented May 23, 2023

@yoannchaudet I don't have any objections to exclusively supporting JS configs. The only issue is that it covertly generates JS configuration without providing any hints or warnings about it

@yoannchaudet
Copy link
Collaborator

Got it. Contributions are open on this repo. Don't hesitate to propose a PR. Keeping this issue open for now.

@timsu92 timsu92 linked a pull request Jun 21, 2023 that will close this issue
@timsu92
Copy link

timsu92 commented Jun 21, 2023

Can you guys take a look whether I've fixed it or not?

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.

4 participants