Winson Liao Winson Liao - 1 year ago 141
AngularJS Question

webpack not producing output files

I am currently trying to run webpack with the command

set NODE_ENV=production && webpack
(Window User) But there was no output within the src directory with the name bundle.js, in fact there was no output file.

I have only used webpack-dev-server until now, so this is the first time I try to build a config file with plugins. webpack-dev-server as I have tried, is running okay.

src folder contains all my files including html and javascript.

I need an output files with working minified and compressed codes. Please assist and advise!!

The below was found in the terminal

Hash: 09ea2200290287327c75
Version: webpack 1.13.2
Time: 6976ms
Asset Size Chunks Chunk Names
bundle.js 3.48 MB 0 [emitted] main
[0] multi main 28 bytes {0} [built]
[1] ./src/index.js 2.73 kB {0} [built]
+ 12 hidden modules

I do have a webpack.config.js file that has the below config.

const path = require('path');
const webpack = require('webpack');
const debug = process.env.NODE_ENV !== "production";

module.exports = {
entry: [
output: {
path: path.resolve(__dirname,'/src'),
filename: 'bundle.js'
devtool: debug ? "inline-sourcemap" : null,
module: {
loader: [{
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['angular']
devServer: {
historyApiFallback: true,
contentBase: 'src'
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false }

Answer Source

This doesn't do what you are expecting:

path : path.resolve(__dirname, '/src')

Because it resolves to /src, and not—as you probably expected—"src/ in the current directory".

For that, use this:

path : path.resolve(__dirname, 'src')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download