-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
64 lines (62 loc) · 2.11 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
const HtmlWebPackPlugin = require("html-webpack-plugin");
const { VueLoaderPlugin } = require("vue-loader");
const ESLintPlugin = require('eslint-webpack-plugin');
const { NormalModuleReplacementPlugin } = require('webpack');
const demo_mode = ("KB_LAYOUT_MANAGER_DEMO_MODE" in process.env);
module.exports = {
mode: 'development',
entry: {
main: './src/client/client.js',
},
output: {
filename: 'client.js',
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.vue$/,
use: ['vue-loader'],
},
{
test: /\.s?(c|a)?ss$/,
oneOf: [
{
// load vue component styles inline
resourceQuery: /^\?vue/,
use: ['vue-style-loader', 'css-loader', {loader: 'sass-loader', options: {sassOptions: {indentedSyntax: true}}}],
},
{
// serve standalone stylesheets as static CSS files
use: [{loader: 'file-loader', options: {name: '[name].css'}}, {loader: 'sass-loader', options: {sassOptions: {indentedSyntax: true}}}],
}
]
},
{
test: /\.html$/,
use: ['html-loader'],
},
{
test: [/\.ico$/, /\.c$/, /\.svg$/],
use: {loader: 'file-loader', options: {name: '[name].[ext]'}},
},
],
},
plugins: [
new HtmlWebPackPlugin({
template: "src/client/index.html",
filename: "index.html",
}),
new VueLoaderPlugin(),
new ESLintPlugin({}),
new NormalModuleReplacementPlugin(
/^\.\/utils\/server_connection.js$/,
function (resource) {
if (demo_mode) {
console.log('[KB_LAYOUT_MANAGER_DEMO_MODE] using mock_server_connection.js');
resource.request = './utils/mock_server_connection.js';
}
},
),
],
};