代码拉取完成,页面将自动刷新
同步操作将从 echozhangzy/vue2_vue-router_bootstrap 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
'use strict';
var webpack = require("webpack");
var path = require("path");
var glob = require('glob')
//路径定义
var srcDir = path.resolve(process.cwd(), 'src'); //process.cwd() 返回运行当前脚本的工作目录的路径
var distDir = path.resolve(process.cwd(), 'dist');
var nodeModPath = path.resolve(__dirname, './node_modules'); //__dirname 脚本的位置
var pathMap = require('./src/pathmap.json');
var publicPath = '/';
//插件定义
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin
module.exports = function(options) {
options = options || {}
var debug = options.debug !== undefined ? options.debug : true;
var plugins = [];
plugins.push(
new CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
"window.$": "jquery"
}),
new HtmlWebpackPlugin({
title: 'Erp',
template: './src/index.ejs',
favicon: './src/img/fav.ico',
// chunks : ['vendor','main'],
minify: {
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true
}
}),
new ExtractTextPlugin("[name].css", { allChunks: true, resolve: ['modules'] })
);
//config
var config = {
entry: {
'vendor': ['jquery', 'bootstrap','whatwg-fetch'],
main: './src/main.js'
},
output: {
path: path.join(__dirname, "dist"),
filename: "js/[name].js",
// chunkFilename: '[chunkhash:8].chunk.js',
publicPath: publicPath
},
module: {
loaders: [
{ test: /\.vue$/, loader: 'vue' }, {
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
// presets: ['es2015'],
// plugins: ['transform-runtime']
}
}, {
test: /\.((woff2?|svg)(\?v=[0-9]\.[0-9]\.[0-9]))|(woff2?|svg|jpe?g|png|gif)$/,
loaders: [
//小于10KB的图片会自动转成dataUrl,
'url?limit=10000&name=img/[hash:8].[name].[ext]',
'image?{bypassOnDebug:true, progressive:true,optimizationLevel:3,pngquant:{quality:"65-80",speed:4}}'
]
}, {
test: /\.((ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9]))|(ttf|eot)$/,
loader: 'url?limit=10000&name=fonts/[hash:8].[name].[ext]'
},
{ test: /\.(tpl|ejs)$/, loader: 'ejs' },
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract("style-loader", "css!sass?sourceMap") },
]
},
resolve: {
extensions: ['', '.js', '.css', '.scss', '.tpl', '.png', '.jpg'],
root: [srcDir, nodeModPath],
alias: pathMap,
publicPath: '/'
},
plugins: plugins,
devtool: '#source-map',
vue: {
loaders: {
css: ExtractTextPlugin.extract("css"),
scss: ExtractTextPlugin.extract("css!sass"),
}
},
}
return config;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。