Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack 完全教程-08-使用UglifyJs Plugin压缩资源 #64

Open
GuoYongfeng opened this issue Jul 24, 2016 · 0 comments
Open

webpack 完全教程-08-使用UglifyJs Plugin压缩资源 #64

GuoYongfeng opened this issue Jul 24, 2016 · 0 comments

Comments

@GuoYongfeng
Copy link
Member

使用UglifyJs Plugin压缩资源

const webpack = require('webpack');

module.exports = {
    entry: './src/entry.js',
    output: {
        path: './dist',
        filename: 'bundle.js',
    },
    module: {
        loaders: [{
            test: /\.js?$/,
            exclude: /node_modules/,
            loader: 'babel',
        }]
    },
    plugins: [
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false,
            },
            output: {
                comments: false,
            },
        }),
    ]
}

运行

$ npm run dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant