Repository navigation
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
executable file
·103 lines (96 loc) · 2.75 KB
/
Copy pathwebpack.config.dev.js
File metadata and controls
executable file
·103 lines (96 loc) · 2.75 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
100
101
102
103
const PUBLIC_PATH = "http://localhost:8081/assets/bundles/";
const ENTRY_PATH = "./frontend/src/";
const ENTRY_FILES = {index:"index.js", contact:"contact.js", services:"services.js", reserve:"reserve.js"};
const OUTPUT_DIR = "/home/erlend/PycharmProjects/andeas/frontend/static/frontend";
const OUTPUT_FILENAME = "[name].js";
const SASS_FILE_PATHS = [
"/home/erlend/PycharmProjects/andeas/frontend/src/",
"/home/erlend/PycharmProjects/andeas/frontend/src/components",
"/home/erlend/PycharmProjects/andeas/node_modules/carbon-components",
"/home/erlend/PycharmProjects/andeas/node_modules/"
];
const ENTRY_WITH_PATH = function() {
let asi = {};
for (let i in ENTRY_FILES){
asi[i] = ENTRY_PATH + i
}
return asi
}();
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const BundleTracker = require('webpack-bundle-tracker');
module.exports = {
entry: ENTRY_WITH_PATH,
output: {
path: OUTPUT_DIR,
publicPath: PUBLIC_PATH,
filename: OUTPUT_FILENAME,
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.css$/i,
use: [
'style-loader',
'css-loader'
],
},
{
test: /\.s[ac]ss$/i,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'fast-sass-loader',
options: {
sassOptions: {
indentWidth: 4,
},
includePaths:SASS_FILE_PATHS
}
}
]
},
{
test: /\.(mp4|png)$/,
use: {
loader: "file-loader",
options: {
name: '[name].[ext]'
}
}
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"
}),
new BundleTracker({filename: './webpack-stats.json'}),
],
devServer: {
compress: true,
port: 8081
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /node_modules/,
chunks: "initial",
name: "vendor",
enforce: true
}
}
}
}
};