赞
踩
修改 webpack.dev.conf.js
中的 devServer
对象加入 disableHostCheck: true
- devServer: {
- disableHostCheck: true,
- }
修改 vue.config.js
的配置
- module.exports = {
- devServer: {
- disableHostCheck: true
- }
- }
修改 vue.config.js
的配置
- devServer: {
- allowedHosts: 'all',
- }
修改前的vue.config.js
:
- const { defineConfig } = require('@vue/cli-service')
- module.exports = defineConfig({
- transpileDependencies: true,
- chainWebpack: config => {
- config.plugin('define').tap(definitions => {
- Object.assign(definitions[0]['process.env'], {
- NODE_HOST: '"http://localhost:8888"',
- });
- return definitions;
- });
- }
- })
修改后的vue.config.js
:
- const { defineConfig } = require('@vue/cli-service')
- module.exports = defineConfig({
- transpileDependencies: true,
- chainWebpack: config => {
- config.plugin('define').tap(definitions => {
- Object.assign(definitions[0]['process.env'], {
- NODE_HOST: '"http://localhost:8888"',
- });
- return definitions;
- });
- },
- devServer: {
- allowedHosts: 'all',
- },
- });
有关分析可以看看这个文章:http://t.csdn.cn/jLgxe
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。