- const path = require('path')
- const webpack = require('webpack')
- const createThemeColorReplacerPlugin = require('./config/plugin.config')
-
- function resolve (dir) {
- return path.join(__dirname, dir)
- }
-
- const vueConfig = {
- publicPath: '/dist',
-
- configureWebpack: {
- plugins: [
- new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
- ],
- externals: {}
- },
-
- chainWebpack: (config) => {
- config.resolve.alias
- .set('@$', resolve('src'))
- const svgRule = config.module.rule('svg')
- svgRule.uses.clear()
- svgRule
- .oneOf('inline')
- .resourceQuery(/inline/)
- .use('vue-svg-icon-loader')
- .loader('vue-svg-icon-loader')
- .end()
- .end()
- .oneOf('external')
- .use('file-loader')
- .loader('file-loader')
- .options({
- name: 'assets/[name].[hash:8].[ext]'
- })
- },
-
- css: {
- loaderOptions: {
- less: {
- javascriptEnabled: true
- }
- }
- },
-
- devServer: {
- port: 8000,
- proxy: {
- '/admin': {
- // target: 'http://压缩的网址:端口号',
- target: 'http://正常调试的网址:端口号',
- ws: false,
- changeOrigin: true
- }
- }
- },
- productionSourceMap: false,
- transpileDependencies: [],
- runtimeCompiler: true
- }
- if (process.env.VUE_APP_PREVIEW === 'true') {
- console.log('VUE_APP_PREVIEW', true)
- vueConfig.configureWebpack.plugins.push(createThemeColorReplacerPlugin())
- }
-
- module.exports = vueConfig
- devServer: {
- port: 8000,
- proxy: {
- '/admin': {
- // target: 'http://压缩网址:端口号',
- target: 'http://正常网址:端口号',
- ws: false,
- changeOrigin: true
- }
- }
- },
- // 建立socket及rtc
- onsocket () {
- if ('WebSocket' in window) {
- const onlyKey = moment().valueOf() + '_pc'
- // 生产环境
- // const url = window.location.hostname + ':8080' + '/websocket?Bedno=' + onlyKey
- // this.ws = new WebSocket('ws://' + url)
- // 开发环境
- this.ws = new WebSocket('ws://网址:端口号/websocket?Bedno=' + onlyKey)
- this.socket.setWs(this.ws)
- } else {
- this.$message.info('您的浏览器不支持websocket')
- }
- this.ws.onmessage = this.onmessage
- this.ws.onopen = this.onopen
- this.ws.onerror = this.onerror
- this.ws.onclose = this.onclose
- },
所以小伙伴在实际运用中,需要用到视频通话,记得需要建立socket!!
- mounted () {
- // 生产环境
- // this.originUrl = window.location.protocol + '//' + window.location.host + '/files/'
- // 开发环境=
- this.originUrl = 'http://网址:端口号/files/'
- this.getfilelist()
- }
友情提示:小伙伴根据自己的实际需要,去增加、删除网址出现的地方!!!