/** * 配置参考: https://cli.vuejs.org/zh/config/ */ 'use strict' const path = require('path') // const defaultSettings = require('./src/settings.js') const CopyPlugin = require('copy-webpack-plugin') function resolve(dir) { return path.join(__dirname, dir) } module.exports = { parallel: false, publicPath: process.env.NODE_ENV === 'staging' ? process.env.VUE_APP_BASE_SUF : '/', assetsDir: 'static', chainWebpack: config => { config.entry('main').add('babel-polyfill') config.entry.app = ['babel-polyfill', './src/page-subspecialty/main.js'] config.resolve.symlinks(true) const svgRule = config.module.rule('svg') svgRule.uses.clear() svgRule .test(/\.svg$/) .use('svg-sprite-loader') .loader('svg-sprite-loader') }, transpileDependencies: ['*'], // transpileDependencies: [ // /(sockjs-client)[/\\\\]/, // /[/\\]node_modules[/\\](.+?)?element-ui(.*)[/\\]src/, // /[/\\]node_modules[/\\](.+?)?element-ui(.*)[/\\]package/, // /[/\\]node_modules[/\\](.+?)?f-render(.*)/ // ], // 默认打开eslint效验,如果需要关闭,设置成false即可 lintOnSave: false, runtimeCompiler: true, productionSourceMap: false, devServer: { inline: true, open: true, hot: true, port: 8002, host: '127.0.0.1', overlay: { errors: true, warnings: true }, headers: { 'X-Frame-Options': 'SAMEORIGIN', 'Access-Control-Allow-Origin': '*' } // proxy: { // 配置跨域 // '/huimu-admin': { // target: 'http://192.168.3.107:8081/huimu-admin', // 这里后台的地址模拟的;应该填写真实的后台接口 // changOrigin: true // 允许跨域 // } // } }, configureWebpack: { resolve: { alias: { 'vue': 'vue/dist/vue.esm.js', '@': resolve('src'), '@static': path.resolve(__dirname, 'static') } }, plugins: [ // new CopyPlugin([ // { from: path.resolve(__dirname, './static'), to: 'static' } // ]) new CopyPlugin({ patterns: [ { from: path.resolve(__dirname, 'static'), to: 'static' } ] }) ] }, // rem适配 // css: { // loaderOptions: { // postcss: { // plugins: [ // require('postcss-plugin-px2rem')({ // rootValue: 50, // 换算基数, 默认100 ,这样的话把根标签的字体规定为1rem为50px,这样就可以从设计稿上量出多少个px直接在代码中写多上px了。 // exclude: /node_modules/i, // mediaQuery: false, // (布尔值)允许在媒体查询中转换px。 // minPixelValue: 3 // 设置要替换的最小像素值(3px会被转rem)。 默认 0 // }) // ] // } // } // }, pages: { index: { template: 'public/index.html', entry: 'src/page-subspecialty/main.js', filename: 'index.html', title: 'index' } // project: { // template: 'public/project.html', // entry: 'src/page-project/main.js', // filename: 'project.html', // title: 'project' // } } }