Skip to content

The development mode no longer works with a library imported via Yalc #35110

@keepeek-rd

Description

@keepeek-rd

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
Binaries:
  Node: 16.13.1
  npm: 8.5.3
  Yarn: 1.22.17
  pnpm: N/A
Relevant packages:
  next: 12.1.0
  react: 17.0.2
  react-dom: 17.0.2

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Since I use version NextJS "12.1.0", when I launch my application in development mode, I have an error in the server console:

$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from C:\dev\dev\XXX\XXX-core\.env.local
info  - Loaded env from C:\dev\dev\XXX\XXX-core\.env
warn  - SWC minify release candidate enabled. https://nextjs.org/docs/messages/swc-minify-enabled
Prepare XXX build client side
Prepare XXX build server side
error - ./.yalc/@XXX/XXX-customers/dist/customers/XXX/index.js
Module parse failed: Cannot use 'import.meta' outside a module (219:16)
File was processed with these loaders:
 * ./node_modules/next/dist/compiled/@next/react-refresh-utils/loader.js
 * ./node_modules/next/dist/build/webpack/loaders/next-swc-loader.js
You may need an additional loader to handle the result of these loaders.
|                 // still a Refresh Boundary later.
|                 // @ts-ignore importMeta is replaced in the loader
>                 import.meta.webpackHot.accept();
|                 // This field is set when the previous version of this module was a
|                 // Refresh Boundary, letting us know we need to check for invalidation or

Note that before I was using version 12.0.4 and that I use yalc link to reference my custom library locally

Expected Behavior

my application launches correctly in development mode (without error) and manages to use my custom library imported with "yalc link"

To Reproduce

Use a next application in version 12.1.0, reference an external NPM library with "yalc link"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions