webpack入口文件会打包成bundle.js
例子:main.js是单入口文件
// main.js
document.write('<h1>Hello World</h1>');
index.html
<script src="./dist//bundle.js"></script>
webpack.config.js
/* webpack.config.js */
module.exports = {
entry : './main.js',
output : {
filename : 'bundle.js'
}
};
webpack

本文介绍了一个简单的Webpack配置案例,通过设置入口文件main.js并将其打包为bundle.js,最终在index.html中加载使用。此过程展示了如何定义Webpack配置文件webpack.config.js的基本结构。
1万+

被折叠的 条评论
为什么被折叠?



