1 Star 0 Fork 20

李传目/HDJS

forked from 后盾人/HDJS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 3.80 KB
一键复制 编辑 原始数据 按行查看 历史
后盾人 提交于 2017-11-27 16:08 . 桌面端增加requirejs包管理
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const webpack = require('webpack');
function resolve(dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
entry: {
hdjs: './src/hdjs.js',
vendor: [
'jquery', 'bootstrap-sass', 'moment'
// , 'bootstrap-switch',
// 'jquery-caret', 'chart.js', 'clockpicker/dist/jquery-clockpicker',
// 'spectrum-colorpicker', 'js-cookie', 'bootstrap-daterangepicker',
// 'jquery-datetimepicker', 'webuploader', 'md5', 'bootstrap-notify',
// 'qrcode', 'select2', 'swiper', 'zeroclipboard', 'video.js/dist/video',
],
// modules: [
// './src/component/ueditor/ueditor.all'
// ]
},
output: {
//输出目录
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
sourceMapFilename: '[name].map',
libraryTarget: "umd",
library: "hdjs",
publicPath: '/dist/',
chunkFilename: "[chunkhash].js",
},
externals: {},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {'vue': 'vue/dist/vue.js', '@': resolve('src')}
},
//热加载使用的项目目录
devServer: {contentBase: path.join(__dirname, "dist"), port: 9000},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ["vendor"],
// minChunks: ({ resource }) => (
// resource &&
// resource.indexOf('node_modules') >= 0 &&
// resource.match(/\.js$/)
// ),
}),
//压缩代码
// new UglifyJSPlugin({output: {comments: false}}),
//清理打包目录
new CleanWebpackPlugin(['dist']),
//生成css文件
new ExtractTextPlugin("hdjs.css"),
//模板文件并生成到dist目录中,用于热加载使用
new HtmlWebpackPlugin({title: 'hdjs-vue', template: __dirname + '/src/module.html'}),
new webpack.ProvidePlugin({$: "jquery", jQuery: "jquery", "window.jQuery": "jquery"}),
new CopyWebpackPlugin([{from: 'static', to: 'static'}])
],
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {loader: 'babel-loader', options: {presets: ['env']}}
},
{
test: /\.(woff|woff2|eot|ttf|svg|jpg|png|gif)$/,
use: [{
loader: 'url-loader',
options: {limit: 10000, name: '[path][name].[ext]',}
}]
},
{
test: /\.css/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [{loader: 'css-loader', options: {minimize: true}}]
})
},
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{loader: 'css-loader', options: {minimize: true}},
{loader: 'less-loader'}
]
})
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{loader: 'css-loader', options: {minimize: true}},
{loader: 'sass-loader'}
]
})
}
]
}
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/ileem/hdjs.git
[email protected]:ileem/hdjs.git
ileem
hdjs
HDJS
master

搜索帮助