Collection of front-end interview skills Part 10: High-frequency test points (implementing small packaging tools)

This is for the record 前端面试的话术集锦第十篇博文——高频考点(实现小型打包工具)and I will keep updating this blog post. ❗❗❗

In this chapter, I will show you how to implement a mini packaging tool with dozens of lines, which can achieve the following two functions:

  1. will be ES6converted toES5

  2. Support files JSwithin filesimport CSS

Through the implementation of this tool, everyone can understand what the principle of packaging tools is.

Because it involves ES6transfer ES5, we first need to install some Babelrelated tools.

yarn add babylon babel-traverse babel-core babel-preset-env  

Next we import these tools into the file:

const fs = require('fs')
const path 

Guess you like

Origin blog.csdn.net/lvoelife/article/details/132691699