1 Star 0 Fork 9

bootstrap-vue/vue2_vue-router_bootstrap

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.allinone.js 3.78 KB
一键复制 编辑 原始数据 按行查看 历史
echozhangzy 提交于 2017-01-18 17:15 . vuex兼容ie 配置修改
'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;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/bootstrap-vue/vue2_vue-router_bootstrap.git
git@gitee.com:bootstrap-vue/vue2_vue-router_bootstrap.git
bootstrap-vue
vue2_vue-router_bootstrap
vue2_vue-router_bootstrap
master

搜索帮助