-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.development.js
104 lines (98 loc) · 3.15 KB
/
config.development.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
const path = require('path');
const settings = require('./config/settings.json');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const colors = require('colors/safe');
const log = (title, data) => console.log(title, data);
module.exports = env => {
log(colors.rainbow('Environment'), colors.bold(colors.white(">> " + env)));
let cleanConfig = {
paths: ['public'],
options: {
root: __dirname,
verbose: (env === 'dev'),
watch: false,
allowExternal: false
}
};
var config = {
mode: 'development',
entry: ['./app/bootstrap.js', './app/style/swag.scss'],
devServer: {
host: settings.devServer.host,
port: settings.devServer.port,
filename: 'app.js',
open: true,
historyApiFallback: {
rewrites: [
{ from: /^\/$/, to: '/index.html' },
{ from: /app.js/, to: '/app.js' }
]
}
},
output: {
filename: settings.output.jsFileName,
path: path.resolve(__dirname, 'public/js')
},
module: {
rules: [
{
test: /\.(png|jpg|svg|gif)$/,
use: [{
loader: "file-loader",
options: {
limit: 10000,
emitFile: true,
useRelativePath: true
}
}]
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: 'vue-style-loader!css-loader!sass-loader', // <style lang="scss">
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax' // <style lang="sass">
}
}
},
{
test: /\.js$/,
exclude: path.resolve(__dirname, './node_modules'),
loader: 'babel-loader',
options: { presets: ['env'] }
},
{
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
'postcss-loader',
'sass-loader',
{
loader: 'sass-resources-loader',
options: {
resources: [
'./app/style/swag.scss'
]
},
},
],
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
plugins: [
new CleanWebpackPlugin(cleanConfig.paths, cleanConfig.options),
new HtmlWebpackPlugin({
title: settings.title
})
]
};
return config;
};