Webpack file packaging error exception

Webpack file packaging error exception

Before webpack packaging, we must ensure that the following work has been completed:

1) Install webpack: Recommended global command npm install -g webpack View webpack version webpack -v

2) Errors may occur when packaging the files at this time, prompting scaffolding file errors, because in the webpack4 version, CLI has been separated out, so we need to install it separately and execute the global command npm install -g webpack-cli. After installing the scaffolding, it stands to reason that the webpack command can be used for normal packaging.

The general syntax for using webpack to package files is: ( This is what the webpack introductory tutorial on Jianshu says )

# {extry file} fills in the path of the entry file. In this article, it is the path of the main.js mentioned above.
# Fill in the storage path of the packaged file in {destination for bundled file}# No need to add {} when filling in the path
webpack {entry file} {destination for bundled file}

# Webpack is not installed globally node_modules/.bin/webpack app/main.js public/bundle.js

So I executed the packaging command webpack a.js bundle.js, but the error WARNING in configuration The 'mode' option has…..

The screenshots are as follows:

這里寫圖片描述

This error message is not because our environment is installed incorrectly, but because webpack 4 has stricter requirements on webpack syntax after the update.

The previous command was revised to webpack a.js –output-filename bundle.js. When this command was executed, the packaging was successful. The screenshots are as follows:

這里寫圖片描述

This is the end of this article about webpack file packaging errors and exceptions. For more related webpack packaging errors, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Teach you how to use webpack to package and compile TypeScript code
  • How to use webpack and rollup to package component libraries
  • Vue packaging uses the image-webpack-loader plug-in to compress and optimize images
  • After the vue-cli+webpack project is packaged to the server, the solution to the problem that the ttf font cannot be found
  • vue solves the problem of uglifyjs-webpack-plugin packaging error
  • Detailed explanation of Webpack4 multi-page application packaging solution
  • In-depth understanding of webpack packaging principles and the implementation of loader and plugin
  • Detailed explanation of the general process of using mocha to perform "smoke testing" on webpack packaged projects

<<:  Database query which object contains which field method statement

>>:  Detailed explanation of the difference between docker-compose ports and expose

Recommend

mysql delete multi-table connection deletion function

Deleting a single table: DELETE FROM tableName WH...

Steps to run ASP.NET Core in Docker container

There are too much knowledge to learn recently, a...

Eight common SQL usage examples in MySQL

Preface MySQL continued to maintain its strong gr...

Implementation of vue-nuxt login authentication

Table of contents introduce Link start Continue t...

A brief discussion on MySQL user permission table

MySQL will automatically create a database named ...

What are the usages of limit in MySQL (recommended)

SELECT * FROM table name limit m,n; SELECT * FROM...

A brief discussion on the problem of forgotten mysql password and login error

If you forget your MySQL login password, the solu...

JS realizes special effects of web page navigation bar

This article shares with you a practical web navi...

In html table, set different colors and widths for each cell

It is recommended that you do not set the width, h...

Installation and configuration of MySQL 5.7.17 free installation version

MYSQL version: MySQL Community Server 5.7.17, ins...

MySQL 8.0.14 installation and configuration method graphic tutorial

This article records the installation and configu...

Ubuntu terminal multi-window split screen Terminator

1. Installation The biggest feature of Terminator...

How to deploy services in Windows Server 2016 (Graphic Tutorial)

introduction Sometimes, if there are a large numb...