1

I'm trying to minimize my bundle.js file with webpack, but getting errors in my config:

module.exports = {
    entry: "./entry.js",
    output: {
        devtoolLineToLine: true,
        sourceMapFilename: "./bundle.js.map",
        pathinfo: true,
        path: __dirname,
        filename: "bundle.js"
    },
    module: {
        loaders: [
            { test: /\.css$/, loader: "style!css" }
        ]
    },
    plugins: [
        new webpack.optimize.UglifyJsPlugin({
            include: /\.min\.js$/,
            minimize: true
        })
    ]
};

The error:

/Users/leongaban/Projects/TickerTags/ionic/TickerTags/www/webpack.config.js:16
        new webpack.optimize.UglifyJsPlugin({
            ^
ReferenceError: webpack is not defined

1 Answer 1

4

Seems like you're missing var webpack = require('webpack'); at the top of your configuration file.

It works for me this way

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks that was it! Now may post another question, I just ran this config and did not notice any minimized file... missing a few more steps I see

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.