logo
  • Guide
  • Config
  • Plugin
  • API
  • Examples
  • Community
  • Modern.js 2.x Docs
  • English
    • 简体中文
    • English
    • Start
      Introduction
      Quick Start
      Upgrading
      Glossary
      Tech Stack
      Core Concept
      Page Entry
      Build Engine
      Web Server
      Basic Features
      Routes
      Routing
      Config Routes
      Data Solution
      Data Fetching
      Data Writing
      Data Caching
      Rendering
      Server-Side Rendering
      Streaming SSR
      Rendering Cache
      Static Site Generation
      Render Preprocessing
      Styling
      Styling
      Use CSS Modules
      Using CSS-in-JS
      Using Tailwind CSS
      HTML Template
      Import Static Assets
      Import JSON Files
      Import SVG Assets
      Import Wasm Assets
      Debug
      Data Mocking
      Network Proxy
      Using Rsdoctor
      Using Storybook
      Testing
      Playwright
      Vitest
      Jest
      Cypress
      Path Alias
      Environment Variables
      Output Files
      Deploy Application
      Advanced Features
      Using Rspack
      Using BFF
      Basic Usage
      Runtime Framework
      Extend BFF Server
      Extend Request SDK
      File Upload
      Cross-Project Invocation
      Optimize Page Performance
      Code Splitting
      Inline Static Assets
      Bundle Size Optimization
      React Compiler
      Improve Build Performance
      Browser Compatibility
      Low-Level Tools
      Source Code Build Mode
      Server Monitor
      Monitors
      Logs Events
      Metrics Events
      Internationalization
      Basic Concepts
      Quick Start
      Configuration
      Locale Detection
      Resource Loading
      Routing Integration
      API Reference
      Advanced Usage
      Best Practices
      Custom Web Server
      Topic Detail
      Module Federation
      Introduction
      Getting Started
      Application-Level Modules
      Server-Side Rendering
      Deployment
      Integrating Internationalization
      FAQ
      Dependencies FAQ
      CLI FAQ
      Build FAQ
      HMR FAQ
      Deprecated
      📝 Edit this page
      Previous pageDependencies FAQNext pageBuild FAQ

      #CLI FAQ

      #Unable to pass command line arguments correctly when using pnpm?

      There are some differences between pnpm v6 and pnpm v7 in how they execute commands, and the following should be noted:

      pnpm v7:

      When using pnpm to call the commands in package.json, if you need to pass parameters to pnpm, you need to put the parameters before the command.

      For example, using the pnpm --filter parameter to run the prepare command:

      pnpm run --filter "./packages/**" prepare

      If you need to pass parameters to the command, you need to put the parameters after the command.

      For example, in the following package.json configuration:

      {
        "scripts": {
          "command": "modern command"
        }
      }

      The way to pass parameters when running the command is:

      pnpm run command --options

      pnpm v6:

      In the following package.json configuration:

      {
        "scripts": {
          "command": "modern command"
        }
      }

      If you need to run modern command --option:

      When using pnpm, you need to run pnpm run command -- --option.

      This is because pnpm's handling of command parameters is different from that of Yarn, but similar to that of npm: when the -- string is not added, the parameters passed are for pnpm; when the -- string is used, the parameters passed are for running the script.

      In the above example, the --option parameter is passed to modern command. If you run pnpm run command --option, the --option parameter will be passed to pnpm.

      In summary:

      When using pnpm v7, if passing parameters to pnpm, the parameters need to be placed before the command.

      When using pnpm v6, if the parameters are passed to pnpm, -- is not required; if the parameters are passed to the script, the -- string needs to be added.