'use strict' const path = require('path') const webpack = require('webpack') const htmlWebpackPlugin = require('html-webpack-plugin') const ExtractTextPlugin = require("extract-text-webpack-plugin") const CopyWebpackPlugin = require("copy-webpack-plugin") module.exports = { entry: { app: './src/app.js', vendor: [ 'jquery', 'angular', 'angular-ui-router', 'angular-cookies', 'oclazyload', 'angular-md5', 'angular-toastr'] }, output: { path: path.resolve(__dirname, '../dist/'), filename: "js/[name].bandle.js", chunkFilename: "[name].bandle.js" }, module: { rules:[ { test: /\.js$/, loader: 'babel-loader', exclude: [ path.resolve(__dirname, '../node_modules') ], include: [ path.resolve(__dirname, '../src') ], query: { presets: ["es2015","stage-0"] } }, { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" }, { test: /\.(woff|woff2)$/, loader:"url?prefix=font/&limit=5000" }, { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" }, { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" }, { test: /\.css$/, exclude: [ path.resolve(__dirname, '../node_modules') ], use: ExtractTextPlugin.extract({ fallback: "style-loader", use: [ { loader: 'css-loader', }, { loader: 'postcss-loader', options: { plugins: ()=>[ require('autoprefixer')({ broswers: [ 'last5versions' ] }) ] } } ] }) }, { test: /\.html$/, use: [ { loader: "html-loader" } ] }, { test: /\.(png|jpe?g|gif|svg)$/i, use: [ { loader: "url-loader?limit=5120&name=images/[name].[ext]" }, { loader: "image-webpack" } ] } ] }, plugins: [ new webpack.optimize.CommonsChunkPlugin({ names: ['vendor', 'manifest'], }), new ExtractTextPlugin('css/[name].css'), new htmlWebpackPlugin({ template: "./src/index.html", filename: "index.html", inject: "body", title: "引导美真的美", minify: { removeComments: true, collapseWhitespace: true } }), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false, drop_console: true }, }), new CopyWebpackPlugin([{ from: path.resolve(__dirname, '../src/favicon.ico') }]), new webpack.ProvidePlugin({ $:"jquery", jQuery:"jquery", "window.jQuery":"jquery" }) ], resolveLoader: { moduleExtensions: ['-loader'] } }
混淆以后的报错是什么?
不压缩,运行就正常