@giovanny.lueilwitz
In webpack, the bundle.js
file is typically generated when you run the webpack build command. To access the bundle.js
file, you can specify the output file path in your webpack configuration file.
Here's an example webpack.config.js file:
1 2 3 4 5 6 7 8 9 |
const path = require('path'); module.exports = { entry: './src/index.js', output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') } }; |
In the above configuration, the output
property specifies the filename of the generated bundle (bundle.js
) and the output directory (dist
). After running the webpack build command (e.g. webpack
or webpack --watch
), you should be able to find the bundle.js
file in the specified output directory.
You can then access the bundle.js
file in your HTML file by including a script tag that points to the generated file:
1
|
<script src="dist/bundle.js"></script> |