# 修改前端文件

现在可以为程序创建新的前端了

1. 编辑器中打开webpack配置文件（webpack.config.js）
2. 修改前端入口用index.jsx替换默认index.html

   ```
   entry: {
     // The frontend.entrypoint points to the HTML file for this build.
     // Use the next line to change the extension. For example, the
     // default configuration changes the extension to `.js`.
     index: path.join(__dirname, info.frontend.entrypoint).replace(/\.html$/, ".jsx"),
   },
   ```
3. 定位plugins项上面的module键的注释例子，然后将下面的几行取消注释

   ```
   module: {
     rules: [
       { test: /\.(js|ts)x?$/, loader: "ts-loader" },
       { test: /\.css$/, use: ['style-loader','css-loader'] }
     ]
   },
   ```

   这些配置允许你的程序使用ts-loader编译器并导入css文件
4. 保存webpack.config.js文件并退出
5. 项目根目录下创建新的tsconfig.json文件
6. 打开tsconfig.json文件，然后复制粘贴下面的内容到文件

   ```
   {
       "compilerOptions": {
         "target": "es2018",        /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
         "lib": ["ES2018", "DOM"],  /* Specify library files to be included in the compilation. */
         "allowJs": true,           /* Allow javascript files to be compiled. */
         "jsx": "react",            /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
       },
       "include": ["src/**/*"],
   }
   ```
7. 保存修改并关闭tsconfig.json文件继续


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mixlabs.gitbook.io/dfinitytutorials/si-.-jiao-cheng/9.-tian-jia-qian-duan-yang-shi/xiu-gai-qian-duan-wen-jian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
