forked from MarhyCZ/ivysilani_tvOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·67 lines (62 loc) · 1.28 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
require('webpack')
const path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const srcRoot = path.resolve(__dirname, 'web/app/')
const distRoot = path.resolve(__dirname, 'docs/app/')
const entry = {
app: srcRoot + '/app.js'
}
const output = {
path: distRoot,
filename: '[name].js'
}
const env = process.env.NODE_ENV || 'development'
const isProd = env === 'production'
const stats = {
modules: false,
chunks: false,
colors: true
}
module.exports = {
devtool: isProd ? 'source-map' : 'eval-source-map',
mode: isProd ? 'production' : 'development',
entry: entry,
output: output,
resolve: {
alias: {
handlebars: 'handlebars/runtime.js'
},
modules: [srcRoot, 'node_modules']
},
module: {
rules: [{
test: /\.js?$/,
exclude: /node_modules|bower_components|native/,
use: [{
loader: 'babel-loader'
}]
}, {
test: /\.hbs$/,
use: [{
loader: 'handlebars-loader'
}]
}, {
test: /\.css$|\.json/,
use: [{
loader: 'raw-loader'
}]
}]
},
plugins: [
new CopyPlugin([
{ from: srcRoot + '/assets', to: distRoot + '/assets' }
])
],
devServer: {
contentBase: distRoot,
compress: true,
inline: false,
port: 9001,
stats
}
}