2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# example.js
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-10 03:34:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```javascript
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								console.log(process.env.NODE_ENV);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 04:59:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import "./example.css";
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								import "react";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import "react-dom";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import "acorn";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import "core-js";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import "date-fns";
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 02:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import "lodash";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import * as _ from "lodash-es";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								console.log(_);
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# webpack.config.js
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-10 03:34:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```javascript
							 
						 
					
						
							
								
									
										
										
										
											2025-07-08 20:46:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"use strict";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								const path = require("path");
							 
						 
					
						
							
								
									
										
										
										
											2025-07-08 20:46:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								module.exports = (env = "development") => ({
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									mode: env,
							 
						 
					
						
							
								
									
										
										
										
											2019-08-12 19:41:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									infrastructureLogging: {
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 04:59:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Optional: print more verbose logging about caching
							 
						 
					
						
							
								
									
										
										
										
											2019-08-12 19:41:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										level: "verbose"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									},
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									cache: {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										type: "filesystem",
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 04:59:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-12 22:37:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// changing the cacheDirectory is optional,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// by default it will be in `node_modules/.cache` 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 04:59:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										cacheDirectory: path.resolve(__dirname, ".cache"),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Add additional dependencies to the build
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										buildDependencies: {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// recommended to invalidate cache on config changes
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// This also makes all dependencies of this file build dependencies
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											config: [__filename]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// By default webpack and loaders are build dependencies
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									module: {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rules: [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												test: /\.css$/,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												use: ["style-loader", "css-loader"]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										]
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								});
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Info
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 02:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## Unoptimized
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2025-07-14 19:02:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								asset output.js 3.61 MiB [emitted] (name: main)
							 
						 
					
						
							
								
									
										
										
										
											2025-08-17 23:11:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								chunk (runtime: main) output.js (main) 2.25 MiB (javascript) 1.29 KiB (runtime) [entry]
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 04:39:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  >  ./example.js main
  
						 
					
						
							
								
									
										
										
										
											2025-08-17 23:11:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  cached modules 2.25 MiB (javascript) 1.29 KiB (runtime) [cached] 1523 modules
							 
						 
					
						
							
								
									
										
										
										
											2025-04-29 02:11:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								webpack X.X.X compiled successfully
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 02:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Production mode
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2025-08-17 23:11:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								asset output.js 549 KiB [emitted] [minimized] [big] (name: main) 1 related asset
							 
						 
					
						
							
								
									
										
										
										
											2025-07-14 19:02:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								chunk (runtime: main) output.js (main) 2.19 MiB (javascript) 1.29 KiB (runtime) [entry]
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 04:39:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  >  ./example.js main
  
						 
					
						
							
								
									
										
										
										
											2025-08-17 23:11:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  cached modules 2.19 MiB (javascript) 1.29 KiB (runtime) [cached] 900 modules
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 02:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								This can impact web performance.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Assets: 
							 
						 
					
						
							
								
									
										
										
										
											2025-08-17 23:11:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  output.js (549 KiB)
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 02:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Entrypoints:
							 
						 
					
						
							
								
									
										
										
										
											2025-08-17 23:11:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  main (549 KiB)
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 02:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      output.js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								WARNING in webpack performance recommendations: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								For more info visit https://webpack.js.org/guides/code-splitting/
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 04:39:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-04-29 02:11:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								webpack X.X.X compiled with 3 warnings
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 20:30:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```