-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
105 lines (93 loc) · 3.11 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const webpack = require('webpack')
const path = require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const ip = require('ip')
const {CleanWebpackPlugin} = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = env => {
const ENV = env.NODE_ENV
let HOST
let WSHOST
if (ENV === 'development') {
HOST = 'http://localhost:3000'
WSHOST = 'localhost:3000'
}
if(ENV === 'qa') {
HOST = 'http://ec2-35-171-19-119.compute-1.amazonaws.com:3000'
WSHOST = 'ec2-35-171-19-119.compute-1.amazonaws.com:3000'
//change these whenever my ec2 dns changes
}
return {
entry: './src/app.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].bundle.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
outputPath: 'img/',
},
},
{
test: /\.(sa|sc|c)ss$/,
use: [
'style-loader',
'vue-style-loader',
'css-loader',
'postcss-loader',
{
// Fixes file paths in url() of sass children
loader: 'resolve-url-loader',
options: {sourceMap: true},
},
// 'sass-loader',
// {
// // Provide path to the file with resources
// loader: 'sass-resources-loader',
// options: {
// resources: path.resolve(__dirname, 'src/css/variables.scss'),
// },
// },
],
},
{
test: /\.(js|vue)$/,
loader: 'string-replace-loader',
query: {
multiple: [
{search: '${HOST}', replace: HOST},
{search: '${WSHOST}', replace: WSHOST}
],
},
}
]
},
plugins: [
new VueLoaderPlugin(),
new CleanWebpackPlugin(),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
title: 'Listening ROom',
template: './index.html'
})
],
devServer: {
host: ip.address(),
port: 8081,
hot: true,
noInfo: true,
historyApiFallback: true //todo added this to get routes to work, check with cam if this is okay
},
performance: {
hints: false
}
}
}