This is a computer translation of the original webpage. It is provided for general information only and should not be regarded as complete nor accurate. |
src/index.js
import bar bar from './bar.js';
bar bar();
src/bar.js
export default function bar bar() {
//
}
Without config or provide custom webpack.config.js
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve 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
.
Get Started quickly in our Guides section, or dig into the Concepts section for more high-level information on the core notions behind webpack.
Through contributions, donations, and sponsorship, you allow webpack to thrive. Your donations directly support office hours, continued enhancements, and most importantly, great documentation and learning material!