Skip to content

sayll/avalon-webpack-start

Repository files navigation

avalon-webpack-start

 Coverage Status   Coverage Status  Coverage Status

Vue users go to: vue-start

React users go to: react-webpack-start

For lower version IE users, please go to: ie-webpack-start

Old scaffold v2.1.0

introduce

In this version, many modules and functions have been deleted to make scaffolding lighter, easier to expand and customize. Used in this project avalon2 As a demonstration framework, demonstrate how to enter development.

About the function of this project

  1. The server uses Express. It should be noted that the only purpose is to provide webpack-dev-middleware and webpack-hot-middleware (Code hot replacement). Replace with a custom Express program webpack-dev-server To make it easier to implement universal rendering and to avoid making the package too large.
  2. Multi thread compilation is adopted for different loaders, which greatly speeds up the compilation speed.
  3. Use webpack DllReferencePlugin extracts fixed resources to speed up compilation and packaging.
  4. Start tree Shaking
  5. Start webpack3 version: scope promotion function
  6. Babel is equipped with transform runtime to optimize the code.
  7. Support mixed development of single page application and multi page application
  8. Automatically import CSS and JS files of the page. No need to set the URL manually
  9. Change file, anti cache hash rule
  10. The modularization of CSS uses postcss+postcss cssnext by default, and handles browser prefixes internally. [See more]( http://cssnext.io/
  11. Fully support the latest features of ES6, package and escape to ES5 to support lower version browsers
  12. Quick compilation, hot update, automatic refresh

Program directory

 ▄ - dist # Package resources ☆ -- internals # project configuration file │› -- webpack # webpack configuration folder │ L -- index. js # Public configuration file ☆ - static # Static resources, bypassing packaging directly ▄ -- app # program source file L --. cache loader # The cache file after the service is started, which is used to quickly start the service next time

Project launch

Environment configuration

  • In order to ensure the normal operation of the project, please update the relevant environment by yourself.
  1. install node.js
  2. install git

Dependent Configuration

  1. First clone project
 $ git clone  https://github.com/sayll/avalon-webpack-start.git $ cd avalon-webpack-start
  1. Download dependency
  • Please ensure that your environment configuration is completed, and then you can start the following steps
     $ npm install # Install project dependencies $ npm start # Compile and launch

If everything goes well, the port can be opened normally: http://127.0.0.1:3001/

Command Description

In the development process, what you will use most is npm run dev , but there are many other processes:

npm run <script> Explain
start Initialize startup project (generate Dll file and start service)
dll Generate Dependency File (Dll)
dev Quick start project (under Dll file generation, service startup can be accelerated)
bundle Package resource analyzer
build Package test environment resources
deploy Package production environment resources
  • Used in the first run start , for subsequent debugging dev

User Manual

  • Project Directory app in views Create a new folder in the directory. The folder name is the name of HTML
  • The index.html, index.js, index.css in the file will be automatically indexed and packaged into resources
  • static The directory is a static file directory, and resources can be accessed directly through '/static/*'
  • The project closes eslint by default. Please go to internals/index.js to configure.
  • Please go directly to internals/index.js Vendors configuration in.

For more configurations, please refer to internals/index.js

About

Webpack3. X (enable tree shaking, scope promotion, etc.) to accelerate project startup

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published