Four dimensional unlock Webpack 3.0 front end of engineering

Source: Internet
Author: User
reasons for the birth of the building

JS Modular

CSS modularity

Webpack Introduction


Methods

compiling ES6

NPM I babel-loader babel-core--save-dev
generator,set,map,array.from,array.prototype.includes
NPM Install @babel/preset-env--save-dev

Global Gasket (for application preparation)
NPM install Babel-polyfill--save
Import " Babel-polyfill "

Local gaskets (prepared for development framework)
will not contaminate the global
Npm install babel-plugin-transform-runtime--save-dev
NPM Install Babel-runtime--save
then set up the related configuration in. babelrc
Compiling typescripts
NPM i typescript ts-loader--save-dev official
Npm i typescript awesome-typescript-loader--save-dev three-party
tsconfig.json< c3/> declaration file (compile in time)
npm I @types/lodash or 
npm install typings typings Install Lodash
But we need to add typeroots to the TS file
Packaging Common Code
Commonschunkplugin

Plugins: [
    New webpack.optimize.CommonsChunkPlugin ({
        Name: ' Common ',
        Minchunks:2
        })
]
code split lazy load

Webpack methods
ES 2015 Loader spec

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.