UNPKG

cloud-pf

Version:

hcm cloud 前端框架使用知识点汇总

66 lines (65 loc) 1.77 kB
/** * Created by xq on 17/4/22. */ const path = require("path"); const webpack = require("webpack"); const HtmlWebpackPlugin = require('html-webpack-plugin'); var script_cnd = ""; if (!(/\/$/).test(script_cnd)) script_cnd += "/"; module.exports = { entry: { "app": ["./webpack/scripts/service.js", "./webpack/scripts/controller.js"] }, externals: { "jquery": 'window.jQuery' }, output: { path: path.join(__dirname, "static"), filename: "scripts/[name]-[hash].js", chunkFilename: "scripts/chunks/[name]-[chunkhash].js", publicPath: script_cnd }, devtool: "source-map", devServer: { compress: true, historyApiFallback: true, hot: true, inline: true, port: 8888, contentBase: "./" }, resolve: { extensions: ['.js', '.css', '.sass'] }, module: { rules: [{ test: /\.css$/, loader: 'style-loader!css-loader' }, { test: /\.scss$/, exclude: /node_modules/, loader: "style-loader!css-loader!sass-loader" }, { test: /\.(gif|png|jpg|svg)$/, loader: 'url-loader?limit=8192&name=resources/images/[hash].[ext]' }] }, plugins: [ new webpack.NamedModulesPlugin(), new webpack.NoEmitOnErrorsPlugin(), new webpack.HotModuleReplacementPlugin(), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }, comments: false, minimize: true }), new HtmlWebpackPlugin({ filename: `app.html`, template: "./webpack/app.tpl", inject: 'body' }) ] };