GithubHelp home page GithubHelp logo

staticwebdev / nextjs-starter Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 28.0 500 KB

A Next.js starter application for deploying to Azure Static Web Apps

Home Page: https://docs.microsoft.com/azure/static-web-apps/deploy-nextjs

JavaScript 83.30% CSS 16.70%
azure-static-web-apps nextjs

nextjs-starter's People

Contributors

aidanhammond avatar christiannwamba avatar craigshoemaker avatar dependabot[bot] avatar fhinkel avatar hannahzhuswe avatar nitya 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

Watchers

 avatar  avatar

nextjs-starter's Issues

[Question] Best way to export with images?

Hi,
I'm not a next.js expert so I hope you'll forgive any stupid things I will ask :)

Currently it uses next export to build the static website and it doesn't support the <img> HTML tag.
So I replaced it with the next.js Image API:

import SmallCard from '../components/SmallCard';
import { projectIcons } from '../components/Icons';

import { projects } from '../utils/projectsData';
import Image from 'next/image';

const Home = () => (
  <div className="home">
    <Image
      src="/images/logo-transparent.png"
      alt="logo"
      width={250}
      height={118}
    />
    <h1>What Can I Deploy to Static Apps?</h1>
...

But the next export requires an Image optimizer service so I used a dummy one

import SmallCard from '../components/SmallCard';
import { projectIcons } from '../components/Icons';

import { projects } from '../utils/projectsData';
import Image from 'next/image';

// opt-out of image optimization, no-op
const customLoader = ({ src }) => {
  return src;
};

const Home = () => (
  <div className="home">
    <Image
      src="/images/logo-transparent.png"
      alt="logo"
      width={250}
      height={118}
      loader={customLoader}
    />
    <h1>What Can I Deploy to Static Apps?</h1>
...

That works but that's a pretty bad workaround I guess.

Is there an Azure service or another way to support static local images ?

Thanks !

Store reports - Action failed with "not found deploy key or tokens"

Following the tutorial at https://docs.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs causes the github action/build Playwright tests to fail on the steps "store reports" and "notify dashboard". I'm not familiar with these actions, but it looks like there is some publishing going on to mspnp/intern-js-pipeline which I'm assuming all users don't have access to.

...
    - name: Publish to external repo
      if: always()
      uses: peaceiris/[email protected]
      with:
        external_repository: mspnp/intern-js-pipeline
        publish_branch: gh-pages
        personal_token: ${{ secrets.PAT_TOKEN }}
        publish_dir: ${{steps.download.outputs.download-path}}
        destination_dir: test-reports/${{ github.repository }}
        keep_files: true
        user_name: "github-actions[bot]"
        user_email: "github-actions[bot]@users.noreply.github.com"
...

image

Related PR: #34

Misc.:

  • The forked repository is a private repository
  • Setup between github and Azure Static Web App works fine, and the workflow in .github\workflow\azure-static-web-apps-<random>.yml deploys the static code to both production and preview deployments fine.

Let me know if you need any more input.

Routing Doesn't Work

Routing doesn't work in this example when deployed on static web apps.

There is no routes.json file, so no matter what url you enter into the address bar, it will always serve you with the main index.html homepage.

Doesn't Use Static Site Generation

This doesn't use Next.js export functionality which produces a statically generated site like Gatsby.js.

I could be wrong but it seems like the predominant use case for combining Next.js with Azure Static Web Apps, would be if you were using Next export to generate a static site.

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.