-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
81 lines (80 loc) · 1.92 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
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const yaml = require('js-yaml');
const fs = require('fs');
const Config = yaml.safeLoad(fs.readFileSync(`${__dirname}/api/env.yml`, 'utf8'));
module.exports = {
entry: [
__dirname + '/src/js/app.js'
],
output: {
path: __dirname + '/www',
filename: 'js/app.js',
},
plugins: [
new HtmlWebpackPlugin({
filename: __dirname + '/www/index.html',
template: __dirname + '/src/index.html',
hash: true,
}),
new ExtractTextPlugin({
filename: 'css/style.css'
}),
new webpack.DefinePlugin({
'process.env.DEV': true,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.apiPath': `"${Config.apigateway.endpoint}"`,
}),
],
resolve: {
extensions: ['.js', '.vue'],
},
externals: [
{
device: true,
},
],
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.(vue|js)$/,
loader: 'eslint-loader',
exclude: /node_modules/,
},
{
test: /\.vue$/,
loader: 'vue-loader',
exclude: /node_modules/,
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader?minimize', 'sass-loader'],
}),
},
{
test: /\.(jpg|jpeg|png|gif)$/,
loaders: 'url-loader',
},
{
test: /\.(ttf|woff|woff2|eot)$/,
loader: 'url-loader',
include: __dirname + '/node_modules/material-design-icons-iconfont',
},
],
},
devServer: {
host: 'localhost',
contentBase: __dirname + '/www',
port: 4000,
headers: { 'Access-Control-Allow-Origin': '*' },
disableHostCheck: true,
},
};