Reputation: 119
I'm trying to get webpack bundle working with my node.js application, but I cant seem to find the physical webpack bundle. Is there even one? I'm familiar with gulp where it outputs a bundle into a folder you specifically choose, but I cant get it to work with webpack. docs aren't that helpful either
Upvotes: 1
Views: 1550
Reputation: 104
Care to post your Webpack config?
Generally speaking, your Webpack config will specify, at minimum, an 'entry' and an 'output'; it will start with your entry (typically an app.js file), do all the bundling and output the resulting bundle where you tell it via 'output' (usually a file that lives in a 'dist' folder that is then run inside of your index.html to produce your app!).
If you're using hot-reloading, then the bundle is in memory only and that's why it's typical to have a 'dev' webpack config and a 'production' config with only the latter writing to disk.
For example, just a basic config with no hot reloading:
module.exports = {
entry: __dirname + '/src/js/app.js',
output: {
filename: __dirname + '/src/js/app-bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/
}
]
},
devtool: 'sourcemap'
}
output can take a number of options: https://webpack.github.io/docs/configuration.html
hope that helps!
Upvotes: 3