Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
77 lines (73 loc) · 2.17 KB
/
Copy pathwebpack.config.js
File metadata and controls
77 lines (73 loc) · 2.17 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const KotlinWebpackPlugin = require("@jetbrains/kotlin-webpack-plugin");
const sourceDirectory = 'src';
const packageDirectory = require('./package.json').kotlinPackage.replace(new RegExp('\\.', 'g'), '/');
module.exports = {
context: __dirname,
entry: {
'vendor': `./${sourceDirectory}/vendor.js`,
'kotlinApp': './kotlin_build/kotlinApp.js'
},
output: {
path: __dirname + '/dist',
filename: '[name].js'
},
resolve: {
// We include 'kotlin_build" in modules because there will be compiled "kotlinApp.js" file
modules: ['node_modules', 'kotlin_build'],
alias: {
_: path.resolve(__dirname, `./${sourceDirectory}/${packageDirectory}`)
}
},
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, '../kotlin_build'),
use: ['@princed/source-map-loader'],
enforce: 'pre',
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: [{loader: 'style-loader'}, {
loader: 'css-loader',
options: {sourceMap: true}
}]
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)(\?.*$|$)/,
loader: 'file-loader'
},
{
test: /\.html$/,
loader: 'raw-loader'
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: `./${sourceDirectory}/index.html`
}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
Popper: 'popper.js'
}),
new KotlinWebpackPlugin({
src: __dirname + `/${sourceDirectory}`
})
],
devtool: 'cheap-module-inline-source-map',
devServer: {
disableHostCheck: true,
proxy: {
'/generate': 'http://localhost:9000'
}
}
};