-
Notifications
You must be signed in to change notification settings - Fork 88
fix: use glob to select files to move #768
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
Conversation
I ran |
Oh, yes! You need to set the env var, because I stopped it being enabled by default. So run |
hmm still not seeing it, despite the tests passing: Logsnetlify-plugin-nextjs on mk/check-locale is 📦 v4.0.0-beta.5 via v15.13.0 took 14s
❯ env EXPERIMENTAL_MOVE_STATIC_PAGES=1 npm run build:demo
> @netlify/plugin-nextjs@4.0.0-beta.5 build:demo
> next build demo
info - Checking validity of types
./pages/api/hello-background.js
1:1 Warning: Assign arrow function to a variable before exporting as module default import/no-anonymous-default-export
./pages/api/hello.js
3:1 Warning: Assign arrow function to a variable before exporting as module default import/no-anonymous-default-export
./pages/api/shows/[...params].js
1:1 Warning: Assign arrow function to a variable before exporting as module default import/no-anonymous-default-export
./pages/api/shows/[id].js
1:1 Warning: Assign arrow function to a variable before exporting as module default import/no-anonymous-default-export
./pages/index.js
7:5 Warning: Do not use <img>. Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element. @next/next/no-img-element
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
warn - using beta Middleware (not covered by semver) - https://nextjs.org/docs/messages/beta-middleware
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
info - Generating static pages (54/54)
info - Finalizing page optimization
Page Size First Load JS
┌ λ / 3.65 kB 84.5 kB
├ /_app 0 B 77 kB
├ ○ /404 288 B 77.3 kB
├ ○ /500 295 B 77.3 kB
├ λ /api/enterPreview 0 B 77 kB
├ λ /api/exitPreview 0 B 77 kB
├ λ /api/hello 0 B 77 kB
├ λ /api/hello-background 0 B 77 kB
├ λ /api/shows/[...params] 0 B 77 kB
├ λ /api/shows/[id] 0 B 77 kB
├ λ /deep/import 3.94 kB 80.9 kB
├ λ /getServerSideProps/[id] 2.11 kB 79.1 kB
├ λ /getServerSideProps/all/[[...slug]] 2.12 kB 79.1 kB
├ λ /getServerSideProps/static 2.06 kB 79 kB
├ ● /getStaticProps/[id] (1064 ms) 1.95 kB 78.9 kB
├ ├ /en/getStaticProps/2 (539 ms)
├ └ /en/getStaticProps/1 (525 ms)
├ ● /getStaticProps/static 1.95 kB 78.9 kB
├ ● /getStaticProps/with-revalidate 1.96 kB 78.9 kB
├ ● /getStaticProps/withFallback/[...slug] (1104 ms) 2 kB 79 kB
├ ├ /en/getStaticProps/withFallback/my/path/1 (571 ms)
├ └ /en/getStaticProps/withFallback/my/path/2 (533 ms)
├ ● /getStaticProps/withFallback/[id] (948 ms) 2 kB 79 kB
├ ├ /en/getStaticProps/withFallback/4 (489 ms)
├ └ /en/getStaticProps/withFallback/3 (459 ms)
├ ● /getStaticProps/withFallbackBlocking/[id] (1022 ms) 2.01 kB 79 kB
├ ├ /en/getStaticProps/withFallbackBlocking/3 (535 ms)
├ └ /en/getStaticProps/withFallbackBlocking/4 (487 ms)
├ ● /getStaticProps/withRevalidate/[id] (ISR: 1 Seconds) (1042 ms) 1.96 kB 78.9 kB
├ ├ /en/getStaticProps/withRevalidate/1 (521 ms)
├ └ /en/getStaticProps/withRevalidate/2 (521 ms)
├ ● /getStaticProps/withRevalidate/withFallback/[id] (ISR: 1 Seconds) (1035 ms) 1.98 kB 79 kB
├ ├ /en/getStaticProps/withRevalidate/withFallback/1 (533 ms)
├ └ /en/getStaticProps/withRevalidate/withFallback/2 (502 ms)
├ ○ /image 4.75 kB 81.7 kB
├ ○ /middle 269 B 77.2 kB
├ ƒ /middle/_middleware 17.4 kB 94.4 kB
├ ● /previewTest 2.02 kB 79 kB
├ λ /shows/[...params] 1.02 kB 81.9 kB
├ λ /shows/[id] 912 B 81.8 kB
├ ○ /static 2.04 kB 79 kB
└ ○ /static/[id] 2.09 kB 79.1 kB
+ First Load JS shared by all 77 kB
├ chunks/framework-41fbbe55a3e94144.js 42.2 kB
├ chunks/main-9fd82dbfda937866.js 32.8 kB
├ chunks/pages/_app-1b0db640e730a7f5.js 495 B
├ chunks/webpack-543008086ebf5176.js 1.45 kB
└ css/27d177a30947857b.css 194 B
ƒ (Middleware) intercepts requests (uses _middleware)
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
Code LGTM |
Oh wait! It needs the plugin to run! So run |
ohhhhhhhhh of course that makes sense lol. everything looks good! |
@@ -150,6 +150,7 @@ exports.configureHandlerFunctions = ({ netlifyConfig, publish, ignore = [] }) => | |||
`${publish}/*.json`, | |||
`${publish}/BUILD_ID`, | |||
`${publish}/static/chunks/webpack-middleware*.js`, | |||
`!${publish}/server/**/*.js.nft.json`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how many cryptocoins for this nft
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're missing a trick there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ascorbic Do you support .nft.json
files currently? I'm wondering what trick you are referencing to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@getTobiasNielsen Oh, it's just a joke about nfts! We don't currently use the json files directly, though we do use nft during the bundle stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that you handle them like vercel does or are there a difference atm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly the same. Vercel does use the JSON files if they exist, but we don't yet and instead do the tracing when bundling, like Vercel does when the JSON files aren't available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
I'm going to merge this and fix the WIndows path issue in a followup up PR |
Previously we used the routes manifest to choose files to move, but this didn't include all files. Switched to glob instead, and add check for whether default locale exists before trying to move it.
Test plan:
Run a build, and check that all html and json files in
.next/server/pages
are moved up into.next
, and are listed in thestatic-manifest.json
. This excludes500.html
,404.html
and all*.nft.json
files