Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is -p in Webpack?

I have this in my package.json:

 build:prod
    SET NODE_ENV=prod && webpack -p

What does -p mean?

I have looked at the webpack documentation, but couldn't find anything for it.

Thanks.

like image 326
tholo Avatar asked Jun 01 '17 13:06

tholo


People also ask

What is webpack is used for?

Webpack is a tool that lets you compile JavaScript modules, also known as module bundler. Given a large number of files, it generates a single file (or a few files) that run your app. It can perform many operations: helps you bundle your resources.

What are 4 core concept of webpack?

There are four basic concepts in webpack: entry , output , modules and plug-ins . These configurations are added in webpack.

What is webpack in a nutshell?

To summarize: Webpack is a module bundler, but you can also use it running tasks as well. Webpack relies on a dependency graph underneath. Webpack traverses through the source to construct the graph, and it uses this information and configuration to generate bundles. Webpack relies on loaders and plugins.

Why we use webpack in react?

Webpack is the recommended bundling solution and should be preferred over Cassette or ASP.NET Bundling. Your project will bundle its own copy of react and react-dom with webpack, and ReactJS.NET will be used only for server-side rendering. Copy from the sample project to the root of your project: package.


1 Answers

The p flag stands for Production. It will perform the following steps:

  • Minification using UglifyJsPlugin
  • Runs the LoaderOptionsPlugin
  • Sets the NodeJS environment variable triggering certain packages to compile differently

Read more about it here.

like image 69
glhrmv Avatar answered Sep 22 '22 14:09

glhrmv