12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- 'use strict'
- const path = require('path')
- function resolve(dir) {
- return path.join(__dirname, dir)
- }
- const name = '家园H5' // page title
- const ip = '0.0.0.0' // dev port
- const port = 9528 // dev port
- const Webpack = require('webpack')
- const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
- module.exports = {
- // 基本路径
- // publicPath: '',
- publicPath: '/industryParkApp/',
- // // 打包构建的文件目录
- outputDir: 'dist',
- // // 指定生成index.html的输出路径
- // indexPath:'index.html',
- // // 存放静态资源的目录
- assetsDir: 'assets',
- lintOnSave: process.env.NODE_ENV === 'development',
- productionSourceMap: false,
- devServer: {
- open: true,
- host: ip,
- port: port,
- https: false,
- disableHostCheck: true,
- // 以上的ip和端口是我们本机的;下面为需要跨域的
- proxy: { // 配置跨域
- '/industryParkApi': {
- // target: 'http://localhost:9001',
- // target: 'http://123.207.115.14:9091',
- target: process.env.VUE_APP_API_URL,
- // https://www.idea-sf.com/industryParkApi
- ws: true,
- changOrigin: true, // 允许跨域
- pathRewrite: {
- '^/industryParkApi': '' // 请求的时候使用这个server就可以
- }
- }
- // '/server': {
- // // target: 'http://localhost:9001',
- // // target: 'http://123.207.115.14:9091',
- // target: process.env.VUE_APP_API_URL,
- // ws: true,
- // changOrigin: true, // 允许跨域
- // pathRewrite: {
- // '^/server': '' // 请求的时候使用这个server就可以
- // }
- // }
- }
- },
- configureWebpack: {
- // provide the app's title in webpack's name field, so that
- // it can be accessed in index.html to inject the correct title.
- name: name,
- resolve: {
- alias: {
- '@': resolve('src')
- }
- },
- externals: {
- 'vue': 'Vue',
- 'vant': 'vant',
- 'moment': 'moment'
- },
- plugins: [
- new BundleAnalyzerPlugin({ // 插件在这里使用
- analyzerHost: '127.0.0.1',
- // 将在“服务器”模式下使用的端口启动HTTP服务器。
- analyzerPort: 8889,
- analyzerMode: 'server',
- openAnalyzer: false
- }),
- new Webpack.ProvidePlugin({
- $: 'jquery',
- jquery: 'jquery'
- })
- ]
- },
- css: {
- loaderOptions: {
- // 给 sass-loader 传递选项
- sass: {
- // @/ 是 src/ 的别名
- data: `@import "@/common/style/index.scss";`
- }
- }
- }
- }
|