> For the complete documentation index, see [llms.txt](https://azr.gitbook.io/webpack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://azr.gitbook.io/webpack/zhun-bei-kai-shi/duo-ge-js-wen-jian.md).

# 多个JS文件

### 结构&目录

新建文件`module.js`

```javascript
module.exports = 'I am module.js';
```

更改入口文件`entry.js`，引入`module.js`

```javascript
document.write('I am entry.js');

document.write('<br/>');
// 引入module.js
document.write(require('./module'));
```

### 命令

重新编译打包

```javascript
$  webpack entry.js  -o  bundle.js --mode=development
```

控制台显示

```javascript
Hash: 51bd2e9e12ee9fc24f1a
Version: webpack 4.26.1
Time: 239ms
Built at: 2018-11-28 11:05:47
    Asset      Size  Chunks             Chunk Names
bundle.js  4.15 KiB    main  [emitted]  main
Entrypoint main = bundle.js
[./entry.js] 96 bytes {main} [built]
[./module.js] 34 bytes {main} [built]
```

### 运行

刷新`index.html`文件页面，显示：

```javascript
I am entry.js
I am module.js
```
