-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
99 lines (96 loc) · 2.9 KB
/
Copy pathwebpack.config.js
File metadata and controls
99 lines (96 loc) · 2.9 KB
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
const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const CopyWebpackPlugin = require('copy-webpack-plugin')
const distFolder = path.resolve(__dirname, 'dist')
const jsLoader = 'babel-loader!standard-loader?error=true'
const isDevelopment = process.env.NODE_ENV !== 'prod'
module.exports = {
entry: './src/index.js',
mode: isDevelopment ? 'development' : 'production',
output: {
filename: '[name].bundle.js?[hash]',
path: distFolder
},
devServer: {
contentBase: './dist/',
https: false,
host: 'localhost',
port: 9080,
hot: true,
inline: true,
stats: { colors: true }
},
devtool: isDevelopment ? 'eval-source-map' : false,
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
filename: 'index.html',
inject: true,
title: 'Beer æpp',
baseUrl: '/',
APIUrl: 'http://localhost:9080/',
alwaysWriteToDisk: true
}),
new HtmlWebpackHarddiskPlugin(),
new ExtractTextPlugin('style.css?[hash]'),
new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: distFolder }),
new CopyWebpackPlugin([
{
from: 'static',
to: '',
ignore: ['.*']
}
]),
new VueLoaderPlugin()
// debug bundle (for optimisation)
// new BundleAnalyzerPlugin()
],
module: {
rules: [
{
test: /\.js$/,
// standard setting for most bundlers web-app setup
// entirely excludes the node_modules folder
exclude: [/node_modules/],
// ...but when using external ES Modules you need to
// include required externals ES modules (eg. our Aepp-SDK) like so:
include: [/node_modules\/@aeternity/, /node_modules\/rlp/, /node_modules\/vue-qrcode-reader/],
loader: jsLoader
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'vue-style-loader',
use: [
'css-loader',
'postcss-loader'
]
// publicPath: '/dist'
})
},
// allows vue compoents in '<template><html><script><style>' syntax
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
js: jsLoader
// scss: 'vue-style-loader!css-loader!sass-loader',
// sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
}
// extractCSS: true
// other vue-loader options go here
}
}
]
}
}