-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
100 lines (99 loc) · 2.26 KB
/
webpack.dev.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
const path = require('path');
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
entry: {
main: './src/app/docfx.ts',
igniteui: './src/styles/ignite-ui/main.scss',
slingshot: './src/styles/slingshot/main.scss',
appbuilder: './src/styles/appbuilder/main.scss'
},
devtool: 'eval-source-map',
externals: {
jquery: 'jQuery'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, './dist/template/bundles')
},
plugins: [
new CleanWebpackPlugin(),
new webpack.ProgressPlugin(),
new MiniCssExtractPlugin({ filename: '[name].css' }),
],
target: ['web', 'es5'],
module: {
rules: [
{
test: /\.ts?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.worker\.js$/,
use: {
loader: "worker-loader"
},
},
{
test: /.(sa|sc|c)ss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: './'
}
},
{
loader: "css-loader",
options: {
sourceMap: false,
}
},
'resolve-url-loader',
{
loader: "sass-loader",
options: {
sourceMap: false
}
}
],
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
{
test: /\.js$/,
include: [
path.resolve(__dirname, "src/app"),
path.resolve(__dirname, "node_modules/highlight.js/lib")
],
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ["@babel/plugin-proposal-class-properties"]
}
}
}],
},
resolve: {
extensions: ['.ts', '.js']
},
optimization: {
moduleIds: 'deterministic',
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
},
},
},
}
}