Commit 299775af authored by 罗超's avatar 罗超

处理上传图片压缩

parent 2db9c308
...@@ -17,3 +17,4 @@ package-lock.json ...@@ -17,3 +17,4 @@ package-lock.json
*.njsproj *.njsproj
*.sln *.sln
yarn.lock yarn.lock
{
...@@ -4,79 +4,77 @@ const utils = require('./utils') ...@@ -4,79 +4,77 @@ const utils = require('./utils')
const config = require('../config') const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf') const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) { function resolve(dir) {
return path.join(__dirname, '..', dir) return path.join(__dirname, '..', dir)
} }
module.exports = { module.exports = {
context: path.resolve(__dirname, '../'), context: path.resolve(__dirname, '../'),
entry: { entry: {
app: './src/main.js' app: './src/main.js'
}, },
output: { output: {
path: config.build.assetsRoot, path: config.build.assetsRoot,
filename: '[name].js', filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production' publicPath: process.env.NODE_ENV === 'production' ?
? config.build.assetsPublicPath config.build.assetsPublicPath : config.dev.assetsPublicPath
: config.dev.assetsPublicPath },
}, resolve: {
resolve: { extensions: ['.js', '.vue', '.json'],
extensions: ['.js', '.vue', '.json'], alias: {
alias: { 'vue$': 'vue/dist/vue.esm.js',
'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'),
'@': resolve('src'),
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
} }
} },
] module: {
}, rules: [{
node: { test: /\.vue$/,
// prevent webpack from injecting useless setImmediate polyfill because Vue loader: 'vue-loader',
// source contains it (although only uses it if it's native). options: vueLoaderConfig
setImmediate: false, },
// prevent webpack from injecting mocks to Node native modules {
// that does not make sense for the client test: /\.js$/,
dgram: 'empty', loader: 'babel-loader',
fs: 'empty', include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
net: 'empty', },
tls: 'empty', {
child_process: 'empty' test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
} loader: 'url-loader',
} options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>微途超级商城</title> <title>微途超级商城</title>
</head> </head>
<body>
<body>
<div id="app"></div> <div id="app"></div>
</body> </body>
</html>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=OV7BZ-ZT3HP-6W3DE-LKHM3-RSYRV-ULFZV"></script>
</html>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=OV7BZ-ZT3HP-6W3DE-LKHM3-RSYRV-ULFZV"></script>
\ No newline at end of file
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"echarts": "^4.8.0", "echarts": "^4.8.0",
"element-ui": "^2.13.1", "element-ui": "^2.13.1",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"lrz": "^4.9.40",
"vue": "^2.5.2", "vue": "^2.5.2",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vuedraggable": "^2.23.2" "vuedraggable": "^2.23.2"
......
...@@ -8,6 +8,7 @@ import ajaxPlug from './plug/index' ...@@ -8,6 +8,7 @@ import ajaxPlug from './plug/index'
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'; import 'element-ui/lib/theme-chalk/index.css';
import echarts from 'echarts' import echarts from 'echarts'
import lrz from 'lrz'
import '../static/UE/ueditor.config.js' import '../static/UE/ueditor.config.js'
import '../static/UE/ueditor.all.js' import '../static/UE/ueditor.all.js'
...@@ -17,17 +18,17 @@ import '../static/UE/ueditor.parse.min.js' ...@@ -17,17 +18,17 @@ import '../static/UE/ueditor.parse.min.js'
Vue.use(ElementUI); Vue.use(ElementUI);
import commonUtils from './assets/utils/commonUtils' import commonUtils from './assets/utils/commonUtils'
Vue.commonUtils = Vue.prototype.$commonUtils=commonUtils Vue.commonUtils = Vue.prototype.$commonUtils = commonUtils
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.http = Vue.prototype.$http = axios Vue.http = Vue.prototype.$http = axios
Vue.prototype.$echarts = echarts Vue.prototype.$echarts = echarts
Vue.use(ajaxPlug) Vue.use(ajaxPlug)
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,
components: { App }, components: { App },
template: '<App/>' template: '<App/>'
}) })
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment