-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
71 lines (69 loc) · 1.96 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
65
66
67
68
69
70
71
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const devMode = process.env.NODE_ENV !== 'production';
module.exports = {
devtool: 'source-map',
entry: {
index: './src/app.ts',
processors: './src/processors/index.ts',
},
output: {
filename: '[id].js',
path: path.resolve(__dirname, 'dist', 'app'),
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.css|\.html$/,
include: /customElements/,
use: 'raw-loader'
},
{
test: /\.css$/i,
exclude: /customElements/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
// you can specify a publicPath here
// by default it uses publicPath in webpackOptions.output
publicPath: '../../style',
},
},
'css-loader',
],
},
],
},
resolve: {
extensions: [ '.ts' ],
modules: ["src", "node_modules"],
alias: {
"@components": path.resolve(__dirname, 'src/components/'),
"@modules": path.resolve(__dirname, 'src/modules/'),
"@nodes": path.resolve(__dirname, 'src/nodes/'),
"@interfaces": path.resolve(__dirname, 'src/interfaces/'),
"@utilities": path.resolve(__dirname, 'src/utilities/'),
"@constants": path.resolve(__dirname, 'src/constants/'),
"src": path.resolve(__dirname, 'src/'),
}
},
plugins: [
new CopyPlugin([
{ from: './src/assets', to: '../assets' },
{ from: './src/index.html', to: '../' },
]),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// all options are optional
filename: devMode ? '../style/[name].css' : '../style/[name].css',
chunkFilename: devMode ? '[id].css' : '[id].css',
}),
],
};