profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/reactcoder-it/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Vadim Pashaev reactcoder-it PXSTUDIO Izhevsk, Russia pxstudio.pw Software develeper and architect 🐱‍🚀👩🏻‍💻🦾

reactcoder-it/100-days-of-code 0

100DaysOfCode R2. Второй раунд моего челенджа. Здесь я углубленно буду изучать проектирование веб-приложений на nodeJS

reactcoder-it/2-nextjs-business-card 0

Разработка веб-приложений на Next.js - Часть 2. Делаем сайт-визитку на Next.js (видео на YT https://youtu.be/2TgKWAckf0k)

reactcoder-it/3-nextjs-components 0

Разработка веб-приложений на Next.js - Часть 3. Разбиваем страницу на компоненты (видео на YT https://youtu.be/2HxHDMatBUU)

reactcoder-it/AIDC-Website 0

AIDC Website running on Nodejs

reactcoder-it/awesome-django 0

A curated list of awesome Django apps, projects and resources.

reactcoder-it/awesome-nextjs 0

:notebook_with_decorative_cover: :books: A curated list of awesome resources : books, videos, articles about using Next.js (A minimalistic framework for universal server-rendered React applications)

reactcoder-it/awesome-nodejs 0

:zap: Delightful Node.js packages and resources

reactcoder-it/awesome-react 0

A collection of awesome things regarding React ecosystem.

Pull request review commentvercel/next.js

Add docs on adding HTTP security headers.

+---+description: Improve the security of your Next.js application by adding HTTP response headers.+---++# Security Headers++To improve the security of your application, you can use [`headers`](/docs/api-reference/next.config.js/headers.md) in `next.config.js` to apply HTTP response headers to all routes in your application.++```jsx+// next.config.js++// You can choose which headers to add to the list+// after learning more below.+const securityHeaders = [];++async headers() {+  return [+    {+      // Apply these headers to all routes in your application.+      source: '/(.*)',+      headers: securityHeaders+    }

@styfle Hi sure , just submitted pull request here: #26375

leerob

comment created time in an hour

PR opened vercel/next.js

add missing closing bracket

<!-- Thanks for opening a PR! Your contribution is much appreciated. In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: -->

Bug

  • [ ] Related issues linked using fixes #number
  • [ ] Integration tests added

Feature

  • [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • [ ] Related issues linked using fixes #number
  • [ ] Integration tests added
  • [ ] Documentation added
  • [ ] Telemetry added. In case of a feature if it's used or not.

Documentation / Examples

  • [ ] Make sure the linting passes
+1 -0

0 comment

1 changed file

pr created time in an hour

issue commentvercel/next.js

Parsing error: Cannot find module 'next/babel'

happens on lerna + create-next-app (next 11.0.0) + Node 14 + VSCode 1.57 + macOS 10.14.5

JoseGarciaM

comment created time in 3 hours

issue commentvercel/next.js

Tailwind CSS base utilities not applied to production builds for TypeScript projects

I am currently experiencing a similar issue. Here is my tailwind config

module.exports = {
  purge: ["./pages/**/*.{js, ts, jsx, tsx}", "./components/**/*.{js,ts,jsx,tsx}"],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
}

I only have a pages and components folder like that in the config.

dbk91

comment created time in 3 hours

issue openedvercel/next.js

Webpack log message fails to insert new line

What version of Next.js are you using?

11.0.0

What version of Node.js are you using?

14.15.1

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying your application?

next dev

Describe the Bug

The info message for "Using webpack 5. Reason: Enabled by default" does not have a new line inserted after it. As shown, the successful compile event message was sent on the same line: info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5event - compiled successfully

Expected Behavior

New line after the webpack info message: info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 event - compiled successfully

To Reproduce

Run next.js project without disabling webpack5 (in my case, also using typescript) image

created time in 4 hours

issue openedvercel/next.js

Deployment hangs while checking types

What version of Next.js are you using?

11.0.0

What version of Node.js are you using?

14.17.1

What browser are you using?

Brave

What operating system are you using?

archlinux

How are you deploying your application?

Vercel

Describe the Bug

Trying to deploy a new Next.js project to Vercel causes UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON

image

The build process doesn't stop. I had to manually cancel it.

This doesn't happen on my machine. Everything compiles just fine.

Expected Behavior

I expect the build to succeed without errors.

To Reproduce

This is a brand new project. .eslintrc:

{
  "plugins": ["prettier"],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:prettier/recommended",
    "next",
    "next/core-web-vitals"
  ]
}

package.json

"dependencies": {
    "@headlessui/react": "^1.2.0",
    "axios": "^0.21.1",
    "next": "11.0.0",
    "next-seo": "^4.26.0",
    "react": "17.0.2",
    "react-dom": "17.0.2"
  },
  "devDependencies": {
    "@types/node": "^15.12.4",
    "@types/react": "17.0.11",
    "@types/react-dom": "^17.0.8",
    "@typescript-eslint/eslint-plugin": "^4.27.0",
    "autoprefixer": "^10.2.6",
    "eslint": "7.29.0",
    "eslint-config-next": "11.0.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^3.4.0",
    "postcss": "^8.3.5",
    "tailwindcss": "^2.2.2",
    "typescript": "4.3.4"
  }

created time in 5 hours

issue commentvercel/next.js

Webpack compat error for wasm files imported in web workers

To patch yourself without using the above PR, you can do this:

next.config.js

const SSRPlugin = require("next/dist/build/webpack/plugins/nextjs-ssr-import")
  .default;
 const { dirname, relative, resolve, join } = require("path");


module.exports = {
  webpack(config) {
     const ssrPlugin = config.plugins.find(
      plugin => plugin instanceof SSRPlugin
    );

    if (ssrPlugin) {
      patchSsrPlugin(ssrPlugin);
    }
  }
}

// Unfortunately there isn't an easy way to override the replacement function body, so we have to just replace the whole plugin `apply` body.
function patchSsrPlugin(plugin) {
  plugin.apply = function apply(compiler) {
    compiler.hooks.compilation.tap("NextJsSSRImport", compilation => {
      compilation.mainTemplate.hooks.requireEnsure.tap(
        "NextJsSSRImport",
        (code, chunk) => {
          // This is the block that fixes https://github.com/vercel/next.js/issues/22581
          if (!chunk.name) {
            return;
          }

          // Update to load chunks from our custom chunks directory
          const outputPath = resolve("/");
          const pagePath = join("/", dirname(chunk.name));
          const relativePathToBaseDir = relative(pagePath, outputPath);
          // Make sure even in windows, the path looks like in unix
          // Node.js require system will convert it accordingly
          const relativePathToBaseDirNormalized = relativePathToBaseDir.replace(
            /\\/g,
            "/"
          );
          return code
            .replace(
              'require("./"',
              `require("${relativePathToBaseDirNormalized}/"`
            )
            .replace(
              "readFile(join(__dirname",
              `readFile(join(__dirname, "${relativePathToBaseDirNormalized}"`
            );
        }
      );
    });
  };
}

This is importing Next internals & mucking with them so it's likely to break in the future. Hopefully we can get that patch upstreamed :)

nickbabcock

comment created time in 6 hours

PR opened vercel/next.js

Skip SSR 'require' modification for chunks without a name

This skips 'require' normalization for chunks without a name, which was throwing errors when used with WASM imports. Fixes #22581.

<!-- Thanks for opening a PR! Your contribution is much appreciated. In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: -->

Bug

  • [x] Related issues linked using fixes #number
  • [ ] Integration tests added

Documentation / Examples

  • [x] Make sure the linting passes
+7 -0

0 comment

1 changed file

pr created time in 7 hours

issue commentvercel/next.js

Proposal: "Wrapper" component for groups of routes in folders

I really like the idea of having a built-in mechanism like this one, it's something I've had to re-create in a couple of different Next apps so far.

I wonder whether tying this to directory tree/routing might be overly restrictive, though. I could see people wanting to specify shared wrapper/layouts with more granularity than what this would allow (i.e. on a page-by-page basis). Maybe a named export on the page could be used to reference a wrapper/layout instead? I guess that would make it more annoying to have the same wrapper used on all pages, so maybe that is just a different proposal with a different set of use cases :)

cassidoo

comment created time in 7 hours

issue commentvercel/next.js

Webpack compat error for wasm files imported in web workers

This workaround doesn't work for me, unfortunately. I'm using wasm-pack and I need the "glue" it produces, which includes the wasm module import.

I've tracked the error down to this line: https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack/plugins/nextjs-ssr-import.ts#L14

chunk.name is undefined. I believe what's happening is that the dynamic import plugin is incorrectly parsing the import statement, that should be getting handled by webpack alone. I'll see if there's some configuration I can pass that will achieve this but I'm not terribly hopeful of finding a fix without Next team help.

nickbabcock

comment created time in 7 hours

issue commentvercel/next.js

Proposal: "Wrapper" component for groups of routes in folders

Would be cool if that wrapper could also allow for rendering stuff for all routes.

For exemple rendering a specific header above every route in a folder without having to include it in every single route or a global navbar (and so on).

Yes @antoinegag! That's what I meant by "set up a layout from there" exactly. Being able to do it this way would reduce the need to use external libraries like this one to make easy layout groups.

cassidoo

comment created time in 8 hours

issue commentvercel/next.js

Proposal: "Wrapper" component for groups of routes in folders

Would be cool if that wrapper could also allow for specific rendering.

For exemple rendering a specific header above every route in a folder without having to include it in every single route or a global navbar (and so on)

cassidoo

comment created time in 8 hours

issue openedvercel/next.js

Proposal: "Wrapper" component for groups of routes in folders

Describe the feature you'd like to request

Right now, it's difficult to share state across only some routes. There's a very "all or nothing" approach to sharing state with just React's useState/useReducer + Context in _app.js. You can work around that (or use libraries like swr and react-query), but it's not very intuitive nor ergonomic.

I'm proposing that there's some kind of "wrapper" component for groups of routes in folders, as seen below.

Describe the solution you'd like

I'm proposing a folder structure similar to this example:

pages/
  examplefolder/
    _index.js
    route1.js
    route2.js
  examplefolder2/
    examplefolder3/
      _index.js
      route3a.js
      route3b.js
    _index.js
    route4.js
    route5.js
  _app.js
  index.js
  ...

If this could exist in Next.js, where _index.js (or some other file name) could "wrap" the other files in that example folder, that would be a really sleek solution to sharing state across groups of routes.

As a developer, I would expect the _index.js files would act on files in their folder just like _app.js does for an entire Next.js application. A developer would able to wrap that component in a Context, or query data, or set up a layout from there.

A solution like this would make for almost a "microsite" type of structure across folders in an app, allowing developers to intuitively make shared layouts and state and have a solid separation of application "sections".

Describe alternatives you've considered

There are some escape hatches built in now for this that aren't very intuitive. The easiest solutions are using swr and react-query, but it would be nice to have a more "vanilla React" way of doing it.

created time in 8 hours

Pull request review commentvercel/next.js

Add docs on adding HTTP security headers.

+---+description: Improve the security of your Next.js application by adding HTTP response headers.+---++# Security Headers++To improve the security of your application, you can use [`headers`](/docs/api-reference/next.config.js/headers.md) in `next.config.js` to apply HTTP response headers to all routes in your application.++```jsx+// next.config.js++// You can choose which headers to add to the list+// after learning more below.+const securityHeaders = [];++async headers() {+  return [+    {+      // Apply these headers to all routes in your application.+      source: '/(.*)',+      headers: securityHeaders+    }

Nice catch, would you like to submit a PR to fix it?

leerob

comment created time in 11 hours

issue commentserialport/node-serialport

segfault after updating from 9.0.7 -> 9.1.0

Got it!

Didn't read down far enough.

robertsLando

comment created time in 12 hours

issue commentserialport/node-serialport

segfault after updating from 9.0.7 -> 9.1.0

If you read the linked issue it didn't work. We just landed another pr that should. It will go out with the next version.

robertsLando

comment created time in 12 hours

issue commentserialport/node-serialport

segfault after updating from 9.0.7 -> 9.1.0

Hi,

I may be missing something, but wasn't 9.2.0 meant to alter the versioning to be exact?

package.json reads (I have installed serialport 9.2.0)

@serialport/bindings": "^9.2.0",

Everything else is fixed.

robertsLando

comment created time in 12 hours

issue commentvercel/next.js

serverless functions not standalone as claimed

Do you think this is related?

https://github.com/vercel/vercel/discussions/6366

fast-reflexes

comment created time in 12 hours

pull request commentvercel/next.js

(next/script): Omit src for children and dangerouslySetInnerHTML props

Failing test suites <!--3036608047-->

Commit: 13748de7d23e58b5ce685daa60093cc29571a2aa

test/integration/build-output/test/index.test.js

  • Build Output > Basic Application Output (with experimental.gzipSize: false) > should not deviate from snapshot

<details> <summary>Expand output</summary>

● Build Output › Basic Application Output (with experimental.gzipSize: false) › should not deviate from snapshot

expect(received).toBeCloseTo(expected, precision)

Expected: 204
Received: 205

Expected precision:    1
Expected difference: < 0.05
Received difference:   1

  130 |           expect(err404Size.endsWith('kB')).toBe(true)
  131 |
> 132 |           expect(parseFloat(err404FirstLoad)).toBeCloseTo(gz ? 66.9 : 204, 1)
      |                                               ^
  133 |           expect(err404FirstLoad.endsWith('kB')).toBe(true)
  134 |
  135 |           expect(parseFloat(sharedByAll)).toBeCloseTo(gz ? 63.7 : 196, 1)

  at Object.<anonymous> (integration/build-output/test/index.test.js:132:47)

</details>

prichodko

comment created time in 13 hours

issue commentserialport/node-serialport

Enhancement: change version interdependencies

Good find!

GazHank

comment created time in 13 hours

push eventserialport/node-serialport

Gareth Hancock

commit sha ba4e4e8327acaedc6a6bfaf83f335ec5d2a47061

Lerna changed to use exact version dependencies (#2276)

view details

push time in 13 hours

PR merged serialport/node-serialport

Lerna changed to use exact version dependencies

Change dependencies of the serialport package to use exact versions. e.g. serialport 9.0.0 would have a dependency on "@serialport/bindings": "9.0.0" instead of "@serialport/bindings": "^9.0.0"

Config Lerna to publish exact version dependencies per https://github.com/serialport/node-serialport/issues/2270

+1 -1

0 comment

1 changed file

GazHank

pr closed time in 13 hours

pull request commentvercel/next.js

(next/script): Omit src for children and dangerouslySetInnerHTML props

Stats from current PR

<details> <summary><strong>Default Server Mode</strong> (Increase detected ⚠️)</summary>

<br/>

<details> <summary><strong>General</strong> Overall increase ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
buildDuration 12.6s 12.6s -23ms
buildDurationCached 3.1s 3.1s -10ms
nodeModulesSize 49.2 MB 49.2 MB ⚠️ +228 B

</details>

<details> <summary><strong>Page Load Tests</strong> Overall increase ✓</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
/ failed reqs 0 0
/ total time (seconds) 2.322 2.268 -0.05
/ avg req/sec 1076.57 1102.19 +25.62
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.287 1.3 ⚠️ +0.01
/error-in-render avg req/sec 1942.82 1923.74 ⚠️ -19.08

</details>

<details> <summary><strong>Client Bundles (main, webpack, commons)</strong> Overall increase ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 20.2 kB 20.2 kB ⚠️ +12 B
webpack-HASH.js gzip 810 B 810 B
Overall change 63 kB 63 kB ⚠️ +12 B

</details>

<details> <summary><strong>Legacy Client Bundles (polyfills)</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB

</details>

<details> <summary><strong>Client Pages</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
_app-HASH.js gzip 801 B 801 B
_error-HASH.js gzip 3.17 kB 3.17 kB
amp-HASH.js gzip 527 B 527 B
css-HASH.js gzip 330 B 330 B
hooks-HASH.js gzip 903 B 903 B
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 1.65 kB 1.65 kB
routerDirect..HASH.js gzip 322 B 322 B
withRouter-HASH.js gzip 320 B 320 B
bb14e60e810b..30f.css gzip 125 B 125 B
Overall change 8.41 kB 8.41 kB

</details>

<details> <summary><strong>Client Build Manifests</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
_buildManifest.js gzip 392 B 392 B
Overall change 392 B 392 B

</details>

<details> <summary><strong>Rendered Page Sizes</strong> Overall increase ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
index.html gzip 523 B 523 B
link.html gzip 532 B 534 B ⚠️ +2 B
withRouter.html gzip 514 B 516 B ⚠️ +2 B
Overall change 1.57 kB 1.57 kB ⚠️ +4 B

</details>

Diffs

<details> <summary>Diff for <strong>main-HASH.js</strong></summary>

@@ -2999,6 +2999,10 @@
             continue;
           }
 
+          if ((dangerouslySetInnerHTML || children) && k === "src") {
+            continue;
+          }
+
           var attr = _headManager.DOMAttributeNames[k] || k.toLowerCase();
           el.setAttribute(attr, value);
         }

</details> <details> <summary>Diff for <strong>index.html</strong></summary>

@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-f7adf56f2601c8465f9f.js"
+      src="/_next/static/chunks/main-761107ed5551b8a9b6bd.js"
       defer=""
     ></script>
     <script

</details> <details> <summary>Diff for <strong>link.html</strong></summary>

@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-f7adf56f2601c8465f9f.js"
+      src="/_next/static/chunks/main-761107ed5551b8a9b6bd.js"
       defer=""
     ></script>
     <script

</details> <details> <summary>Diff for <strong>withRouter.html</strong></summary>

@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-f7adf56f2601c8465f9f.js"
+      src="/_next/static/chunks/main-761107ed5551b8a9b6bd.js"
       defer=""
     ></script>
     <script

</details> </details> <hr/> <details> <summary><strong>Serverless Mode</strong> (Increase detected ⚠️)</summary>

<br/>

<details> <summary><strong>General</strong> Overall increase ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
buildDuration 14.4s 14.3s -121ms
buildDurationCached 4.2s 4.3s ⚠️ +32ms
nodeModulesSize 49.2 MB 49.2 MB ⚠️ +228 B

</details>

<details> <summary><strong>Client Bundles (main, webpack, commons)</strong> Overall increase ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 20.2 kB 20.2 kB ⚠️ +12 B
webpack-HASH.js gzip 810 B 810 B
Overall change 63 kB 63 kB ⚠️ +12 B

</details>

<details> <summary><strong>Legacy Client Bundles (polyfills)</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB

</details>

<details> <summary><strong>Client Pages</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
_app-HASH.js gzip 801 B 801 B
_error-HASH.js gzip 3.17 kB 3.17 kB
amp-HASH.js gzip 527 B 527 B
css-HASH.js gzip 330 B 330 B
hooks-HASH.js gzip 903 B 903 B
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 1.65 kB 1.65 kB
routerDirect..HASH.js gzip 322 B 322 B
withRouter-HASH.js gzip 320 B 320 B
bb14e60e810b..30f.css gzip 125 B 125 B
Overall change 8.41 kB 8.41 kB

</details>

<details> <summary><strong>Client Build Manifests</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
_buildManifest.js gzip 392 B 392 B
Overall change 392 B 392 B

</details>

<details> <summary><strong>Serverless bundles</strong> Overall increase ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
_error.js 16.9 kB 16.9 kB ⚠️ +2 B
404.html 1.98 kB 1.98 kB
500.html 1.96 kB 1.96 kB
amp.amp.html 10.8 kB 10.8 kB
amp.html 1.17 kB 1.17 kB
css.html 1.35 kB 1.35 kB
hooks.html 1.23 kB 1.23 kB
index.js 17.2 kB 17.2 kB
link.js 17.5 kB 17.5 kB
routerDirect.js 17.3 kB 17.3 kB
withRouter.js 17.3 kB 17.3 kB
Overall change 105 kB 105 kB ⚠️ +2 B

</details>

</details> <hr/> <details> <summary><strong>Webpack 4 Mode</strong> (Increase detected ⚠️)</summary>

<br/>

<details> <summary><strong>General</strong> Overall increase ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
buildDuration 11.2s 11.3s ⚠️ +131ms
buildDurationCached 4.7s 4.5s -142ms
nodeModulesSize 49.2 MB 49.2 MB ⚠️ +228 B

</details>

<details> <summary><strong>Page Load Tests</strong> Overall decrease ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
/ failed reqs 0 0
/ total time (seconds) 2.281 2.326 ⚠️ +0.04
/ avg req/sec 1096.16 1074.79 ⚠️ -21.37
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.286 1.324 ⚠️ +0.04
/error-in-render avg req/sec 1944.57 1888.86 ⚠️ -55.71

</details>

<details> <summary><strong>Client Bundles (main, webpack, commons)</strong> Overall increase ⚠️</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
677f882d2ed8..HASH.js gzip 13.3 kB 13.3 kB
framework.HASH.js gzip 41.8 kB 41.8 kB
main-HASH.js gzip 7.99 kB 8 kB ⚠️ +7 B
webpack-HASH.js gzip 757 B 757 B
Overall change 63.8 kB 63.9 kB ⚠️ +7 B

</details>

<details> <summary><strong>Legacy Client Bundles (polyfills)</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB

</details>

<details> <summary><strong>Client Pages</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
_app-HASH.js gzip 1.07 kB 1.07 kB
_error-HASH.js gzip 3.84 kB 3.84 kB
amp-HASH.js gzip 536 B 536 B
css-HASH.js gzip 333 B 333 B
hooks-HASH.js gzip 910 B 910 B
index-HASH.js gzip 227 B 227 B
link-HASH.js gzip 1.64 kB 1.64 kB
routerDirect..HASH.js gzip 295 B 295 B
withRouter-HASH.js gzip 292 B 292 B
e025d2764813..52f.css gzip 125 B 125 B
Overall change 9.28 kB 9.28 kB

</details>

<details> <summary><strong>Client Build Manifests</strong></summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
_buildManifest.js gzip 420 B 420 B
Overall change 420 B 420 B

</details>

<details> <summary><strong>Rendered Page Sizes</strong> Overall decrease ✓</summary>

vercel/next.js canary prichodko/next.js fix/next-script-src-inline Change
index.html gzip 568 B 568 B
link.html gzip 581 B 581 B
withRouter.html gzip 561 B 560 B -1 B
Overall change 1.71 kB 1.71 kB -1 B

</details>

Diffs

<details> <summary>Diff for <strong>main-HASH.js</strong></summary>

@@ -175,6 +175,10 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
             continue;
           }
 
+          if ((dangerouslySetInnerHTML || children) && k === "src") {
+            continue;
+          }
+
           var attr = _headManager.DOMAttributeNames[k] || k.toLowerCase();
           el.setAttribute(attr, value);
         }

</details> <details> <summary>Diff for <strong>index.html</strong></summary>

@@ -23,7 +23,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-a24959f9624e5f7ac792.js"
+      src="/_next/static/chunks/main-f23e849bcc6eff1762e6.js"
       defer=""
     ></script>
     <script

</details> <details> <summary>Diff for <strong>link.html</strong></summary>

@@ -23,7 +23,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-a24959f9624e5f7ac792.js"
+      src="/_next/static/chunks/main-f23e849bcc6eff1762e6.js"
       defer=""
     ></script>
     <script

</details> <details> <summary>Diff for <strong>withRouter.html</strong></summary>

@@ -23,7 +23,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-a24959f9624e5f7ac792.js"
+      src="/_next/static/chunks/main-f23e849bcc6eff1762e6.js"
       defer=""
     ></script>
     <script

</details> </details> Commit: 13748de7d23e58b5ce685daa60093cc29571a2aa

prichodko

comment created time in 13 hours

PR opened serialport/node-serialport

Lerna changed to use exact version dependencies

Change dependencies of the serialport package to use exact versions. e.g. serialport 9.0.0 would have a dependency on "@serialport/bindings": "9.0.0" instead of "@serialport/bindings": "^9.0.0"

Config Lerna to publish exact version dependencies per https://github.com/serialport/node-serialport/issues/2270

+1 -1

0 comment

1 changed file

pr created time in 13 hours

issue commentserialport/node-serialport

Enhancement: change version interdependencies

@reconbot looks like we need to use lerna publish --exact

per https://github.com/lerna/lerna/issues/2836

If this doesnt work we should probably add to that issue rather than making a new one?

GazHank

comment created time in 13 hours

issue commentvercel/next.js

next/script using beforeInteractive strategy don't work with alert

Related: https://github.com/vercel/next.js/issues/26240

dudusotero

comment created time in 13 hours

issue commentvercel/next.js

next/script using beforeInteractive strategy don't work with alert

@balazsorban44 is correct regarding the _document usage.

There is an issue, however, with a next/script used as a children or through dangerouslySetInnerHTML and beforeInteractive strategy.

In this case the value of src is (unknown):

image

Looking at this line https://github.com/vercel/next.js/blob/canary/packages/next/client/script.tsx#L120, the default value of src is set to empty string, which seems to be propagated to the DOM element as the unknown value.

dudusotero

comment created time in 13 hours

PR opened vercel/next.js

adds with-ts-jest example

<!-- Thanks for opening a PR! Your contribution is much appreciated. In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: -->

Documentation / Examples

  • [ ] Make sure the linting passes

This PR adds an example with-ts-jest that shows how to properly set up and configure ts-jest to work with nextjs.

+674 -0

0 comment

26 changed files

pr created time in 13 hours

issue closedvercel/next.js

[docs] Env loading in a jest testing environment is too vague

What version of Next.js are you using?

Latest

What version of Node.js are you using?

N/A

What browser are you using?

N/A

What operating system are you using?

N/A

How are you deploying your application?

N/A

Describe the Bug

The documentation assumes Jest will automatically execute an exported async function. However, this is not the case for files loaded through setupFiles/setupFilesAfterEnv.

Jest will execute function exports from globalSetup and globalTeardown; however setupFiles and setupFilesAfterEnv will not.

This can lead to confusion: #26005 on how to load Envs in a test environment.

This also leads to the next problem, currently Jest doesn't fully support ESM and therefore you have to use babel-jest and a custom babel configuration to transpile ESM to CommonJS: babeljs docs, CRA jest config and with-jest example. Otherwise, you'll run into this error:

<details> <summary>Jest Error</summary>

Test suite failed to run

Jest encountered an unexpected token

Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

By default "node_modules" folder is ignored by transformers.

Here's what you can do:
 • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
 • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
 • If you need a custom transformation specify a "transform" option in your config.
 • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation

/home/m6d/Desktop/myapp/utils/loadConfig.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { loadConfig } from "@next/env";
                                                                                  ^^^^^^

SyntaxError: Cannot use import statement outside a module

</details>

Therefore the documentation, as described below, is too vague:

// The below can be used in a Jest global setup file or similar for your testing set-up
import { loadEnvConfig } from '@next/env'
export default async () => {  
 const projectDir = process.cwd()  
 loadEnvConfig(projectDir)
}

Reference to PR: #22982

Expected Behavior

Clear up the documentation by:

❶ Specifying that a custom babel configuration is required: .babelrc

{  
  "presets": ["next/babel"] 
}

or

babel.config.js:

module.exports = (api) => {
  api.cache(() => process.env.NODE_ENV);

  return {
    presets: ["next/babel"],
  };
};

❷ Specifying which jest property should be to used to load Envs. Since there's no consensus, and loadConfig is not a Promise, I'd recommend setupFiles: jest.config.js

module.exports = {
  "testEnvironment": "jsdom",
  "clearMocks": true,
  "moduleDirectories": ["<rootDir>", "node_modules"],
  "moduleNameMapper": {
    ".*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/utils/fileMock.js",
    "\\.(css|scss)$": "identity-obj-proxy"
  },
  "transform": {
    "^.+\\.(ts|js)x?$": "babel-jest",
    ".+\\.(css|styl|less|sass|scss)$": "jest-css-modules-transform"
  },
  "testPathIgnorePatterns": [
    "<rootDir>/.next",
    "<rootDir>/coverage",
    "<rootDir>/node_modules",
    "<rootDir>/public",
    "<rootDir>/babel.config.js",
    "<rootDir>/next.config.js"
  ],
  "collectCoverageFrom": ["**/*.{js,jsx}"],
  "coveragePathIgnorePatterns": ["<rootDir>/pages"],
  "setupFiles": ["<rootDir>/utils/loadEnv.js"],
}

❸ Updating the documentation code to simply import and invoke the loadConfig function: utils/loadEnv.js

import { loadConfig } from "@next/env"

loadConfig(process.cwd())

Alternatively, avoid all of the above, update the with-jest example to include environment loading and replace the documentation code with a simple link to the with-jest example:

<details open> <summary><b>Examples</b></summary> <ul> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-jest">Jest with Environment Variables</a></li> </ul> </details>

To Reproduce

N/A

closed time in 14 hours

mattcarlotta