Reputation: 352
I can't get webpack to actually generate the output file. I can run webpack
and I get webpack: bundle is now VALID with no errors but no file is ever created. I have tried changing my output directory too, nothing seems to work.
I have read many posts addressing the same issue but nobody has been able to figure this mystery out. Example webpack config:
var webpack = require('webpack'),
path = require('path');
module.exports = {
debug: true,
entry: {
main: './assets/js/components/test.js'
},
output: {
path: path.join('./dist'),
filename: 'bundle.js',
},
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
}
]
}
};
Upvotes: 0
Views: 735
Reputation: 352
So after some trial and error the solution ended up being that I needed to run webpack
from the package.json by adding it as a script. Still don't understand why I can't just run webpack
from the Terminal. Anyone know why it has to be a script like this?
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack"
},
and then run this command in Terminal:
npm start
Upvotes: 0
Reputation: 6413
According to https://webpack.github.io/docs/configuration.html#output-path
The output directory as an absolute path (required).
Have you tried the following for your output path?
path: path.join(__dirname, 'dist'),
Upvotes: 2