Smarter webpack dev server config
This commit is contained in:
		
							parent
							
								
									b852a92a67
								
							
						
					
					
						commit
						1ec705ba3f
					
				| 
						 | 
					@ -29,19 +29,31 @@ module.exports = {
 | 
				
			||||||
    assetsSubDirectory: 'static',
 | 
					    assetsSubDirectory: 'static',
 | 
				
			||||||
    assetsPublicPath: '/',
 | 
					    assetsPublicPath: '/',
 | 
				
			||||||
    proxyTable: {
 | 
					    proxyTable: {
 | 
				
			||||||
      '/api': {
 | 
					      '**': {
 | 
				
			||||||
        target: 'http://nginx:6001',
 | 
					        target: 'http://nginx:6001',
 | 
				
			||||||
        changeOrigin: true,
 | 
					        changeOrigin: true,
 | 
				
			||||||
        ws: true
 | 
					        ws: true,
 | 
				
			||||||
 | 
					        filter: function (pathname, req) {
 | 
				
			||||||
 | 
					          let proxified = ['.well-known', 'staticfiles', 'media', 'instance', 'api']
 | 
				
			||||||
 | 
					          let matches = proxified.filter(e => {
 | 
				
			||||||
 | 
					            return pathname.match(`^/${e}`)
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					          return matches.length > 0
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      '/media': {
 | 
					      // '/.well-known': {
 | 
				
			||||||
        target: 'http://nginx:6001',
 | 
					      //   target: 'http://nginx:6001',
 | 
				
			||||||
        changeOrigin: true,
 | 
					      //   changeOrigin: true
 | 
				
			||||||
      },
 | 
					      // },
 | 
				
			||||||
      '/staticfiles': {
 | 
					      // '/media': {
 | 
				
			||||||
        target: 'http://nginx:6001',
 | 
					      //   target: 'http://nginx:6001',
 | 
				
			||||||
        changeOrigin: true,
 | 
					      //   changeOrigin: true,
 | 
				
			||||||
      }
 | 
					      // },
 | 
				
			||||||
 | 
					      // '/staticfiles': {
 | 
				
			||||||
 | 
					      //   target: 'http://nginx:6001',
 | 
				
			||||||
 | 
					      //   changeOrigin: true,
 | 
				
			||||||
 | 
					      // },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // CSS Sourcemaps off by default because relative paths are "buggy"
 | 
					    // CSS Sourcemaps off by default because relative paths are "buggy"
 | 
				
			||||||
    // with this option, according to the CSS-Loader README
 | 
					    // with this option, according to the CSS-Loader README
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue