search
HomeWeb Front-endJS Tutorialbabel-loader file preprocessor usage instructions
babel-loader file preprocessor usage instructionsMay 08, 2018 pm 06:08 PM
Instructions for useprocessor

This time I bring you instructions for using the babel-loader file preprocessor. What are the precautions when using the babel-loader file preprocessor? Here are practical cases, let’s take a look.

Today we are introduced to babel-loader, which is used to process ES6 syntax and compile it into js syntax that the browser can execute.

Installation

We need to use babel-loader babel-core babel-preset

Compatible version: webpack 3. x | babel-loader 8.x | babel 7.x

npm install babel-loader@8.0.0-beta.0 @babel/core @babel/preset-env webpack
webpack 3.x babel-loader 7.x | babel 6.x

Use

Let’s start with a little chestnut:

var htmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
module.exports = {
  mode: 'development',
  entry: './src/app.js',
  output: {
    filename: 'js/bundle.js',
    path: path.resolve(dirname, 'dist')
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/, // (不处理node_modules 和 bower_components下的js文件) 优化处理加快速度
        use: {
          loader: 'babel-loader',
          options: {     // options选项中的presets设置的就是当前js的版本
            presets: ['@babel/preset-env']
          }
        }
      }
    ]
  },
  plugins: [
    new htmlWebpackPlugin({
      template: 'index.html',
      inject: 'body',
      filename: 'index.html'
    })
  ]
}

You can use options Attributes to pass options to the loader.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Calling the Baidu map plug-in in Vue

Detailed instructions for using jointjs in vue

Detailed explanation of unit and E2E testing steps with Angular CLI

The above is the detailed content of babel-loader file preprocessor usage instructions. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
octa core处理器是哪个厂商的octa core处理器是哪个厂商的Jul 20, 2022 am 11:20 AM

octa core处理器是“全志”厂商的;octa core处理器相当于麒麟中的一种八核处理器芯片,octa core处理器采用了类似麒麟710的14nm工艺,全志科技经营的范围包括电子元器件、软件的研发及销售。

mt6877 5g是什么处理器mt6877 5g是什么处理器Aug 24, 2022 pm 03:19 PM

“mt6877 5g”指的是天玑900系列芯片;2021年5月,联发科发布了旗下的天玑900系列芯片,又名mt6877,天玑900是基于6nm工艺制造,采用八核CPU架构,包括2个主频“2.4GHz”的“arm Cortex-A78”大核和6个主频“2.0GHz”的“Arm Cortex-A55”高能效核心。

sdm710是什么处理器sdm710是什么处理器Jul 04, 2022 am 11:28 AM

sdm710是高通骁龙710处理器;骁龙710是高通首款700系列处理器,代号为sdm710,该处理器于2018年5月推出,基于10nm制程工艺,拥有八核心CPU架构,两个2.2GHz大核,六个1.7GHz小核,GPU型号是Adreno 616,支持“QC 4+”快充技术。

intel xeon是什么处理器intel xeon是什么处理器Nov 24, 2022 pm 05:40 PM

intel xeon是Intel的至强处理器,是英特尔生产的微处理器,它用于"中间范围"的企业服务器和工作站。Xeon基于奔腾微处理器P6构架,它被设计成与新的快速外围元件互连线以及加速图形端口一起工作;装有Xeon微处理器的计算机一般可使用Windows NT、NetWare或Unix操作系统。

mali g610是什么处理器mali g610是什么处理器Jul 27, 2022 am 11:08 AM

“mali g610”是“mali GPU”中“ARM Valhall GPU”架构处理器的第三代产品;Mali是一款高端GPU,主要应用基于ARM体系结构的移动设备上,“mali GPU”最早由挪威科技大学项目独立出来成立的Falanx公司开发。

e1080八核是什么处理器e1080八核是什么处理器Nov 30, 2022 pm 05:08 PM

E080八核是指Exynos 1080八核处理器。Exynos 1080采用5nm工艺制程,采用1个大核+3个中核+4个小核的核心配置,其中大核与中核采用的是A78的架构,小核采用的是A55的架构。Exynos 1080的GPU采用来自ARM的Mali-G78核心MP10,在Mahattan v3标准下,GPU的性能整体提升了2.3倍之多;并且独家开发了Amigo电源分配方案。

苹果12用的什么处理器苹果12用的什么处理器Aug 30, 2022 pm 03:48 PM

苹果12也即iphone12采用的是“A14 Bionic”处理器;“A14”是苹果公司推出并搭载在第四代“iPad Air”和iphone12系列手机中的处理器,采用了5nm芯片工艺,cpu采用6核设计,性能较A12芯片提升“40%”,GPU采用4核设计,性能较A12芯片提升超“30%”。

t610是什么处理器t610是什么处理器Nov 10, 2022 am 11:36 AM

T610处理器是由紫光展锐研发的一颗基于12nm工艺的4G芯片,是一款4G手机的中端处理器;该处理器CPU由2颗基于Cortex-A75架构的大核心和6颗基于Cortex-A55架构的小核心组成,最高主频为1.8GHz,GPU采用的是614.4MHz得Mail-G52。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!