-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathwebpack.config.js
96 lines (93 loc) · 2.77 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
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var path = require('path');
function getEntrySources(sources) {
if (process.env.NODE_ENV !== 'production') {
sources.push('webpack-dev-server/client?http://localhost:8888');
sources.push('webpack/hot/only-dev-server');
}
return sources;
}
module.exports = {
entry: {
devices: getEntrySources([
'./src/js/index.js'
])
},
output: {
publicPath: 'http://localhost:8888/',
filename: 'js/[name].js',
path: path.resolve(__dirname, 'dist')
},
devServer: {
port: 8888,
host: "0.0.0.0",
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*'
},
publicPath: "http://localhost:8888/"
},
module: {
rules: [
{
test: /\.js$/,
use: [{loader: 'react-hot-loader'}, {loader: 'jsx-loader'}, {loader: 'babel-loader'}],
exclude: /(node_modules|src\/components)/
},
{
test: /\.scss$/,
use: [
{loader:'style-loader'},
{loader:'css-loader', options:{sourceMap: true}},
{loader:'sass-loader', options:{sourceMap: true}}
]
},
{
test: /\.css$/,
use: [
{loader:'style-loader'},
{loader:'css-loader', options:{sourceMap: true}},
]
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader',
options: {mimetype: 'image/svg+xml'}
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader",
options: {mimetype: "application/font-woff"}
},
{
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader",
options: {mimetype: "application/font-woff"}
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader",
options: {mimetype:"application/octet-stream"}
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader"
}
]
},
plugins: [
new CopyWebpackPlugin([
{ from: 'src/html/index.html', to: 'index.html' },
{ from: 'src/js/views/flows/vendor.js', to: 'js/vendor.js' },
{ from: 'src/js/polyfills/localStorage.js', to: 'js/localStorage.js' },
{ from: 'node_modules/leaflet/dist/leaflet.css', to: 'leaflet.css' },
{ from: 'node_modules/leaflet/dist/images', to: 'images' },
{ from: 'node_modules/ace-builds/src-min', to: 'js/ace'},
{ from: 'node_modules/materialize-css/dist/js/materialize.min.js', to: 'js/materialize.js'},
{ from: 'node_modules/jquery/dist/jquery.min.js', to: 'js/jquery.js'},
{ from: 'node_modules/jquery-ui-dist/jquery-ui.min.js', to: 'js/jquery.ui.js'},
{ from: 'src/img', to: 'images' }
]),
]
};