Giter Club home page Giter Club logo

nuxt-full-static's Introduction

Hi all! ๐Ÿ‘‹

I lead the Nuxt core team. I'm also a core team member of Elk and a @vuejs community partner. You can also see me at work across the @unjs ecosystem and further afield.

I have written a number of libraries that make use of type inference to improve developer experience, such as magic-regexp, typed-vuex and sanity-typed-queries.

I am also a Microsoft MVP in Developer Technologies and a Google GDE in Web Performance.

๐Ÿ‘‰ You can find out more info and other social links on my website.

nuxt-full-static's People

Contributors

danielroe avatar lgtm-com[bot] avatar pi0 avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nuxt-full-static's Issues

fix: Double requests being made on client-side

๐Ÿ› The bug

After some testing of the module it looks like that it's actually doing two requests per page on the client-side. One for the static json file and one for the actual API.

I've tried the example from the docs with adding a process.server check to my useAsyncData but that just returns false.

๐Ÿ› ๏ธ To reproduce

https://stackblitz.com/github/danielroe/nuxt-full-static/tree/main/playground

๐ŸŒˆ Expected behaviour

When click on the individual posts I would expect it to only make a request for the static json file but it also makes a request to the API ๐Ÿ™‚

Screenshot 2022-09-04 at 19 17 42

โ„น๏ธ Additional context

No response

fix: it work only with external url

๐Ÿ› The bug

It work only with external url
Work

const data = await useFetch('https://jsonplaceholder.typicode.com/posts', {
  transform: posts => posts.slice(0, 10),
})

Local not work, return html of index page

const data2 = await useFetch('http://localhost:3000/api/test', {
  transform: posts => posts.slice(0, 10),
})

๐Ÿ› ๏ธ To reproduce

https://github.com/max5432112345/nuxt-error3

๐ŸŒˆ Expected behaviour


โ„น๏ธ Additional context

No response

fix: nuxt-content issue

๐Ÿ› The bug

nuxt-full-static not working with @nuxt/content

I added @nuxt/content and got the error as below.

ERROR  Rollup error:  Unexpected token (Note that you need plugins to import files that are not JavaScript)
 at error (node_modules/rollup/dist/es/shared/rollup.js:1888:30)
 at Module.error (node_modules/rollup/dist/es/shared/rollup.js:12442:16)
 at Module.tryParse (node_modules/rollup/dist/es/shared/rollup.js:12819:25)
 at Module.setSource (node_modules/rollup/dist/es/shared/rollup.js:12724:24)
 at ModuleLoader.addModuleSource (node_modules/rollup/dist/es/shared/rollup.js:22166:20)

This is in Stackblitz.

I tried to use this in my current nuxt-3 project.

The error I got in the project is as below:

 ERROR  Cannot start nuxt:  nuxtCtx.tryUse is not a function                                                              11:28:24

  at useNuxt (/D:/MyProject/node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:48:28)
  at extendViteConfig (/D:/MyProject/node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:780:16)
  at addVitePlugin (/D:/MyProject/node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:806:3)
  at initNuxt (/D:/MyProject/node_modules/nuxt/dist/index.mjs:1443:3)
  at Object.ready (/D:/MyProject/node_modules/nuxt/dist/index.mjs:1421:18)
  at load (/D:/MyProject/node_modules/nuxi/dist/chunks/dev.mjs:6768:27)
  at async Object.invoke (/D:/MyProject/node_modules/nuxi/dist/chunks/dev.mjs:6813:5) 
  at async _main (/D:/MyProject/node_modules/nuxi/dist/cli.mjs:46:20)

nuxt.config.ts

import { defineNuxtConfig } from "nuxt";
export default defineNuxtConfig({
 modules: ["@nuxtjs/tailwindcss", "@nuxt/content", "nuxt-full-static],
})

package.json

{
  "devDependencies": {
    "@nuxt/content": "^2.0.1",
    "@nuxtjs/tailwindcss": "^5.3.0",
    "nuxt": "3.0.0-rc.6"
  },
}

๐Ÿ› ๏ธ To reproduce

https://stackblitz.com/edit/github-p1mkc1?file=package.json

๐ŸŒˆ Expected behaviour

After adding nuxt-content module, it should work without any errors.

โ„น๏ธ Additional context

No response

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

  • chore(deps): update all non-major dependencies (@release-it/conventional-changelog, @types/node, @vitest/coverage-c8, c8, eslint, eslint-config-prettier, expect-type, husky, lint-staged, node, pathe, pnpm, prettier, release-it, typescript, vitest, vue)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • codecov/codecov-action v3
.github/workflows/codeql.yml
  • actions/checkout v3
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
npm
package.json
  • @nuxt/kit 3.0.0-rc.8
  • pathe ^1.0.0
  • @nuxt/module-builder ^0.1.7
  • @nuxt/schema 3.0.0-rc.9-27702110.abd5dc5
  • @nuxt/test-utils 3.0.0-rc.8
  • @nuxtjs/eslint-config-typescript ^12.0.0
  • @release-it/conventional-changelog ^5.1.0
  • @types/node ^18.7.2
  • @vitest/coverage-c8 ^0.22.1
  • c8 ^7.12.0
  • conventional-changelog-conventionalcommits ^5.0.0
  • eslint ^8.23.0
  • eslint-config-prettier ^8.5.0
  • eslint-plugin-prettier ^4.2.1
  • expect-type ^0.13.0
  • husky ^8.0.1
  • lint-staged ^13.0.3
  • nuxt 3.0.0-rc.9-27702110.abd5dc5
  • pinst ^3.0.0
  • prettier ^2.7.1
  • release-it ^15.4.0
  • typescript ^4.8.2
  • vitest ^0.22.1
  • vue ^3.2.37
  • node 18.12.0
  • pnpm 7.9.5
playground/package.json
  • nuxt ^3.0.0-rc.8

  • Check this box to trigger a request for Renovate to run again on this repository

feat: support pinia store / `$fetch` alls

๐Ÿ†’ Your use case

Some sites, e.g. this one rely mainly on pinia. Right now, the content is still inlined, which can lead to enormous HTML size and thus to crawlers (like the twitter crawler for OG tags) not even crawling the page.

๐Ÿ†• The solution you'd like

Ideally, the pinia content could also be extracted into the payload too!

I am mainly using netlify-builder image and static route rules, so the current supported scenario (hybrid mode) would be more than sufficient for my use case.

๐Ÿ” Alternatives you've considered

No response

โ„น๏ธ Additional info

No response

help: Running Nitro alongside the static site

๐Ÿ“š What are you trying to do?

Hi!

I've tested this package out for my server-side rendered Nuxt 3 app and it works great!

My only issue is that I have some Nitro API's that is being requested at runtime, so I wonder if it would be possible to generate both a static site and build the Nitro API's as well and then be able to serve both with yarn start? :-)

๐Ÿ” What have you tried?

yarn generate --> only static files generated
yarn build --> only SSR site generated

โ„น๏ธ Additional context

The goal is to have a Nuxt 3 site running statically on Netlify while still have my API's available as functions for client-side requests.

"npm run build" fails (inferred type of 'default' cannot be named)

๐Ÿ› The bug

Node 18.8.0
Npm 8.18.0
OS: Win11

I've just cloned the repo (v0.2.1), installed dependencies and issued npm run build command. Here's the output I got:

src/module.ts(5,1): error TS2742: The inferred type of 'default' cannot be named without a reference to '@nuxt/kit/node_modules/@nuxt/schema'. This is likely not portable. A type annotation is necessary.
src/module.ts(5,1): error TS2742: The inferred type of 'default' cannot be named without a reference to '@nuxt/kit/node_modules/@nuxt/schema'. This is likely not portable. A type annotation is necessary.

Error: Failed to compile. Check the logs above.
    at error (file:///C:/Users/iamma/Desktop/Dev/nuxt-full-static/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
    at throwPluginError (file:///C:/Users/iamma/Desktop/Dev/nuxt-full-static/node_modules/rollup/dist/es/shared/rollup.js:21781:12)
    at Object.error (file:///C:/Users/iamma/Desktop/Dev/nuxt-full-static/node_modules/rollup/dist/es/shared/rollup.js:22503:20)
    at Object.error (file:///C:/Users/iamma/Desktop/Dev/nuxt-full-static/node_modules/rollup/dist/es/shared/rollup.js:21958:42)
    at Object.transform (file:///C:/Users/iamma/Desktop/Dev/nuxt-full-static/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.mjs:1590:26)
    at file:///C:/Users/iamma/Desktop/Dev/nuxt-full-static/node_modules/rollup/dist/es/shared/rollup.js:22710:40
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  id: 'C:\\Users\\iamma\\Desktop\\Dev\\nuxt-full-static\\src\\module.ts',
  hook: 'transform',
  code: 'PLUGIN_ERROR',
  plugin: 'dts',
  watchFiles: [
    'C:\\Users\\iamma\\Desktop\\Dev\\nuxt-full-static\\src\\module.ts'
  ]
}

๐Ÿ› ๏ธ To reproduce

https://stackblitz.com/github/danielroe/nuxt-full-static/tree/main/playground

๐ŸŒˆ Expected behaviour

Build process should succeed

โ„น๏ธ Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.