Entry, output, module analysis of webpack3.x
This time I will bring you the entry, output, and module analysis of webpack3. one time.
As a popular tool today, webpack is inseparable from the three major front-end frameworks, so it is necessary to learn it;
Prerequisites: There is a node environment and npm tools; (new version The node comes with the npm tool);
Now let’s do it step by step:
1. First select a directory as the location where your project is stored;
cmd The tool enters the project directory (assuming mine is D:\webpack-demo4); and then uses nmp
to installwebpack: npm install webpack --save-dev("Global installation is not recommended"); Use npm init after finishing your project directory, followed by some descriptive content. How to omit it and directly npm init -y;
dist and src directories I created it myself, dist is used to store compiled files, and src is used to store source files; node_modules is a newly initialized folder with various modules in it. In the future, all modules related to project construction will be (it should also be ) placed in this directory; webpack.config.js is the webpack configuration item; package.json is some configuration for node operations (in fact, it is for webpack);
Webpack.config.js configuration (so many for now) );
First of all, let’s talk about what this configuration is used for. In fact, it is to tell webpack how to package; explain them one by one; ##Entry file
<html> <head> <title>Output Management(输出)</title> <meta charset=utf-8> </head> <body> </body> </html> <script src="./js/app.bundle.js"></script>
index.js import _ from 'lodash'; import '../css/style1.css'; import icon1 from '../img/aa00.jpg'; import printMe from './print.js'; function component() { var div = document.createElement('div'); var btn = document.createElement('button'); // Lodash(目前通过一个 script 脚本引入)对于执行这一行是必需的 div.innerHTML = _.join(['Hello', 'webpack'], ' '); var img = new Image(); img.src = icon1; div.appendChild(img); btn.innerHTML = 'Click me and check the console!'; btn.onclick = printMe; div.appendChild(btn); return div; } document.body.appendChild(component()); //放回元素给到页面;
export default function printMe() { console.log('print.js...');} 完成之后,直接
believe it After reading the case in this article, you have mastered the method. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Related reading:
How VUE uses anmate.css
How to solve the css Hack of IE11
The above is the detailed content of Entry, output, module analysis of webpack3.x. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

During the development process of Python, we often encounter module not found errors. The specific manifestation of this error is that Python reports one of two errors: ModuleNotFoundError or ImportError when importing the module. This error is very annoying and can cause the program to not run properly, so in this article, we will explore the causes of this error and how to solve it. ModuleNotFoundError and ImportError in Pyth

In the Java9 version, the Java language introduced a very important concept: module. If you are familiar with the modular management of JavaScript code, you should feel familiar when you see the modular management of Java 9. 1. What is Javamodule? Somewhat similar to packages in Java, modules introduce another level of grouping of Java code. Each such group (module) contains many sub-packages. Declare the folder and its subfolders as a module by adding the file module-info.java to the root of a module's source code file package. The file syntax

Front-end output configuration requires specific code examples. In front-end development, output configuration is a very important configuration. It is used to define the file path, file name and related resource paths generated after the project is packaged. This article will introduce the role of front-end output configuration, common configuration options, and give specific code examples. The role of output configuration: The output configuration item is used to specify the file path and file name generated after the project is packaged. It determines the final output of the project. Packaged in webpack etc.

Once you have all your assets together, you need to tell webpack where to package your application. The output attribute of webpack describes how to handle bundled code. The following article will give you an in-depth understanding of the output (Output) in the core concept of webpack. I hope it will be helpful to you!

1. First confirm the Linux system kernel [root@localhost~]#uname-r-p2.6.18-194.el5i6862. Go to http://sourceforge.net/projects/linux-ntfs/files/ to download the rpm package of the corresponding kernel. If you can't find the exact same one, you can find the closest one. I couldn't find the exact same one. What I downloaded is: kernel-module-ntfs-2.6.18-128.1.1.el5-2.1.27-0.rr.10.11.i686.rpm3. Install the rpm package rpm-ivhkernel -m

Vuex mainly consists of the following five parts: State, Getter, Mutation, Action, and Module. Below I will introduce Vuex Module-state warehouse segmentation. I hope it will be helpful to friends in need!

Python's os module is one of the standard libraries used for interacting with the operating system. It provides many useful functions and variables for working with files and directories. The following are the usage of some common os module functions: 1. Get the current working directory: importoscwd=os.getcwd()print(cwd) 2. Switch the current working directory: importosos.chdir('/path/to/new/directory' )3. List all files and subdirectories in the directory: importosfiles=os.listdir('/path/to/dire

This article will explain in detail how PHP outputs GD images to a browser or file. I think it is quite practical, so I share it with you as a reference. I hope you can gain something after reading this article. PHP outputs GD images to a browser or file Introduction The phpGD library provides powerful functions for processing images, allowing you to create, edit and output images. Images can be output to a browser or file for display or further processing. Output to Browser To output an image to a browser, use the following steps: Create an image resource: Use the imagecreate() function to create an image resource. Load image data: use imagepng(), imagejpeg() or imagegif()
