Movatterモバイル変換


[0]ホーム

URL:


webpack logo
ag grid
ag charts

Installation

This guide goes through the various methods used to install webpack.

Prerequisites

Before we begin, make sure you have a fresh version ofNode.js installed. The current Long Term Support (LTS) release is an ideal starting point. You may run into a variety of issues with the older versions as they may be missing functionality webpack and/or its related packages require.

Local Installation

The latest webpack release is:

GitHub release

To install the latest release or a specific version, run one of the following commands:

npminstall --save-dev webpack# or specific versionnpminstall --save-dev webpack@<version>
tip

Whether to use--save-dev or not depends on your use cases. Say you're using webpack only for bundling, then it's suggested that you install it with--save-dev option since you're not going to include webpack in your production build. Otherwise you can ignore--save-dev.

If you're using webpack v4 or later and want to callwebpack from the command line, you'll also need to install theCLI.

npminstall --save-dev webpack-cli

Installing locally is what we recommend for most projects. This makes it easier to upgrade projects individually when breaking changes are introduced. Typically webpack is run via one or morenpm scripts which will look for a webpack installation in your localnode_modules directory:

"scripts":{"build":"webpack --config webpack.config.js"}
tip

To run the local installation of webpack you can access its binary version asnode_modules/.bin/webpack. Alternatively, if you are using npm v5.2.0 or greater, you can runnpx webpack to do it.

Global Installation

The following NPM installation will makewebpack available globally:

npminstall --global webpack
warning

Note that this isnot a recommended practice. Installing globally locks you down to a specific version of webpack and could fail in projects that use a different version.

Bleeding Edge

If you are enthusiastic about using the latest that webpack has to offer, you can install beta versions or even directly from the webpack repository using the following commands:

npminstall --save-dev webpack@next# or a specific tag/branchnpminstall --save-dev webpack/webpack#<tagname/branchname>
warning

Take caution when installing these bleeding edge releases! They may still contain bugs and therefore should not be used in production.

6 Contributors

pksjcebebrawsimon04EugeneHlushkosibiraj-schenxsan

[8]ページ先頭

©2009-2025 Movatter.jp