src/index.js
import bar from './bar';
bar();
export default function bar() {
//
}
Without config or provide custom webpack.config.js
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
}
};
<!doctype html>
<html>
<head>
...
</head>
<body>
...
<script src="dist/bundle.js"></script>
</body>
</html>
然后在命令行运行 webpack
就会创建 bundle.js
。
通过你的贡献、捐款或者赞助,webpack 将获得繁荣发展。你的捐助直接用于支持我们付出工作、持续改进,最加重要的是有助于我们提供优秀的文档和资料!
The following persons/organizations made their first donation in the last 14 days (limited to the top 10).