代码拉取完成,页面将自动刷新
'use strict';
/**
* Created by LeungZ on 2016/3/11.
*/
//------------------webpack build config----------------//
const contentPath = './app';
const sourcePath = './app/src';
const buildPath = './dist';
//const proxy = null;
// Set webpack dev server proxy
const proxy = {
"/ctg-imageconsole-web/*": // API requests which matched will be proxied to backend server
{
// target: 'http://132.122.239.4:8083' // config backend server
target: 'http://42.123.125.170:8083' // config backend server
// target: 'http://10.4.231.123:8089' // config backend server
}
};
//---------------webpack build config-----------------//
var webpack = require('webpack');
var path = require('path');
var autoprefixer = require('autoprefixer');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var isDev = (process.env.npm_lifecycle_event === 'dev') || (process.env.npm_lifecycle_event === 'server');
var config = {
context: path.resolve(__dirname, contentPath),
entry: {
vendor: ['jquery', 'angular', 'echarts', 'js-yaml',
"codemirror", 'codemirror/addon/lint/lint', 'codemirror/mode/yaml/yaml', 'codemirror/mode/dockerfile/dockerfile',
'xterm', 'xterm/addons/fit/fit'],
app: "./entry.js"
},
output: {
path: path.resolve(__dirname, buildPath),
filename: './js/' + (isDev ? "[name].js" : "[name].min.js")
},
module: {
noParse: [/xterm.js/],
loaders: [
{
test: require.resolve("jquery"),
loader: 'expose?jQuery'
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'ng-annotate!babel?presets[]=es2015'
},
{
test: /\.html$/,
exclude: /index.html/,
loader: 'ngtemplate?relativeTo=' + (path.resolve(__dirname, sourcePath)) + '/!html?attrs=false'
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract("style", isDev ? "css?-url&sourceMap!postcss!sass?sourceMap" : "css?-url&minimize!postcss!sass")
},
{
test: /\.json$/,
loader: "json-loader"
}
]
},
postcss: [autoprefixer({browsers: ['> 10%'], cascade: false})],
plugins: [
new CleanWebpackPlugin(buildPath),
new CopyWebpackPlugin([
{from: '*.min.css', to: 'css', context: 'pasp'},
{from: '*.min.js', to: 'js', context: 'pasp'},
{from: 'images', to: 'images'},
{from: 'fonts', to: 'fonts'}
], {
copyUnmodified: true
}),
new ExtractTextPlugin("css/" + (isDev ? "app.css" : "app.min.css")),
new HtmlWebpackPlugin({
isDev: isDev,
chunks: ['app'],
template: './index.html',
minify: {
removeComments: isDev ? false : true,
collapseWhitespace: isDev ? false : true
}
}),
new webpack.optimize.CommonsChunkPlugin("vendor", isDev ? './js/vendor.js' : './js/vendor.min.js'),
new webpack.optimize.UglifyJsPlugin({
output: {
comments: false
}
})
]
};
if (process.env.npm_lifecycle_event === 'dev') {
config.devtool = "cheap-inline-module-source-map";
config.plugins.pop();
}
if (process.env.npm_lifecycle_event === 'server') {
config.devtool = "source-map";
config.plugins.shift();
config.plugins.pop();
config.devServer = {
contentBase: path.resolve(__dirname, buildPath),
port: '33001'
};
if (proxy) {
config.devServer.proxy = proxy;
}
}
module.exports = config;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。