Getting Started 开始
Install esbuild 安装 esbuild
First, download and install the esbuild command locally. A prebuilt native executable can be installed using npm (which is automatically installed when you install the node JavaScript runtime): 首先,在本地下载并安装 esbuild 命令。可以使用 npm 安装预构建的本机可执行文件(在安装 node JavaScript 运行时时自动安装):
npm install --save-exact esbuild
npm install --save-exact esbuild
This should have installed esbuild in your local node_modules
folder. You can run the esbuild executable to verify that everything is working correctly: 这应该在您的本地 node_modules
文件夹中安装了 esbuild。您可以运行 esbuild 可执行文件来验证一切是否正常工作:
.\node_modules\.bin\esbuild --version
.\node_modules\.bin\esbuild --version
The recommended way to install esbuild is to install the native executable using npm. But if you don't want to do that, there are also some other ways to install. 安装 esbuild 的推荐方法是使用 npm 安装本机可执行文件。但是,如果您不想这样做,还有其他一些安装方法。
Your first bundle 您的第一个捆绑包
This is a quick real-world example of what esbuild is capable of and how to use it. First, install the react
and react-dom
packages: 这是一个快速的真实示例,说明了 esbuild 的功能以及如何使用它。首先,安装 react
和 react-dom
包:
Then create a file called app.jsx
containing the following code: 然后创建一个名为包含以下代码 app.jsx
的文件: