| Feb | MAR | Apr |
| 16 | ||
| 2021 | 2022 | 2023 |
COLLECTED BY
Collection: Save Page Now
import bar from './bar.js';
bar();
src/bar.js
export default function bar() {
//
}
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
};
page.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
...
</head>
<body>
...
<script src="dist/bundle.js"></script>
</body>
</html>
Then run webpack on the command-line to create bundle.js.