Webpack environment to build the basic framework

Source: Internet
Author: User
Tags postcss

First, the installation of Babel related

1, installation dependent

CNPM i-d babel-core babel-loader babel-preset-env babel-preset-stage-2 babel-plugin-transform-runtime

2, new. BABELRC

{presets: [["Env",          {            "Targets": {              "Browsers": ["Last 5 versions","IE >= 8"]            }          }        ],        "babel-preset-stage-2"], plugins: ['Transform-runtime'    ]}

3, related webpack.conf.js fragments

module: {     rules: [            {               /\.vue$/,               ' Vue-loader ',            },     ]}

Second, the installation of static resources family barrels (img/svg, font icons, css/scss/style/postcss/autoprefixer)

1, installation dependent

CNPM i-d style-loader url-loader sass-loader node-sass css-loader autoprefixer-loader postcss-loader autoprefixer Extrac T-text-webpack-plugin file-Loader# god pit NPM rebuild node-sass

2, related webpack.conf.js fragments

module: {rules: [{test:/\. (SCSS|SASS|CSS) $/, use: [{loader:' Style-loader '}, {loader:' Css-loader '}, {loader:' Postcss-loader ', Options: {sourcemap:true, Plugins: ()= = [Autoprefixer ({browsers: [' IOS >= 7 ', ' Android >= 4.1 ']})],},}, {loader:' Sass-loader ', query: {sourcemap:true} }]}, {test:/\.woff (\?v=\d+\.\d+\.\d+)? $/, Loader:' Url-loader ', Options: {limit:10000, Minetype:' Application/font-woff ',},}, {test:/\.ttf (\?v=\d+\.\d+\.\d+)? $/, Loader:' Url-loader ', Options: {limit:10000, Minetype:' Application/octet-stream ',},}, {test:/\.eot (\?v=\d+\.\d+\.\d+)? $/, Loader:' Url-loader ', Options: {limit:10000, Minetype:' Application/vnd.ms-fontobject ',},}, {test:/\.svg (\?v=\d+\.\d+\.\d+)? $/, Loader:' Url-loader ', Options: {limit:10000, Minetype:' Image/svg+xml ',},}, {test:/\. (png|jpg|jpeg|gif) (\?v=\d+\.\d+\.\d+)? $/I, loader:' Url-loader ', Options: {limit:10000,                },            }        ]    },

Webpack environment to build the basic framework

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.