-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.js
55 lines (53 loc) · 1.3 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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const { DefinePlugin } = require('webpack')
module.exports = env => ({
mode: 'production',
entry: {
build: path.join(__dirname, 'src', 'build.tsx'),
workItem: path.join(__dirname, 'src', 'workItem.tsx'),
},
output: {
clean: true,
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
// LHS must match webpack `externals` of sarif-web-component.
extensions: ['.js', '.ts', '.tsx'],
alias: {
'React': path.resolve('node_modules/react'),
'ReactDOM': path.resolve('node_modules/react-dom'),
},
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.s?css$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{ test: /\.png$/, use: 'url-loader' },
{ test: /\.woff$/, use: 'url-loader' },
]
},
devServer : {
host: '0.0.0.0', // Necessary to server outside localhost
port: 8080,
https: true,
},
plugins: [
new DefinePlugin({
CONNECTION_STRING: JSON.stringify(env?.CONNECTION_STRING ?? ''),
}),
new CopyWebpackPlugin({
patterns: [{ from: "**/*.{html,css}", context: "src" }],
}),
],
})