forked from ste-xx/json-schema-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
58 lines (57 loc) · 1.53 KB
/
webpack.common.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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
module.exports = {
entry: './src/index.ts',
target: 'web',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.md$/i,
type: 'asset/resource'
},
],
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ],
},
output: {
filename: 'bundle.[chunkhash].js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new HtmlWebpackPlugin({
title: 'JSON Schema Viewer',
template: 'index.html',
publicPath: process.env.WEBPACK_PUBLIC_PATH ?? '/',
filename: 'index.html'
}),
new CspHtmlWebpackPlugin({
'script-src': ["'strict-dynamic'", "https://cdn.jsdelivr.net/npm/monaco-editor@0.36.1/"],
'style-src': ["'unsafe-inline'", "'self'", "https://cdn.jsdelivr.net/npm/monaco-editor@0.36.1/"]
}),
new webpack.DefinePlugin({
'process': undefined,
'process.release': null
}),
new webpack.EnvironmentPlugin({
ANALYTICS_NEXT_MODERN_CONTEXT: true
}),
new FaviconsWebpackPlugin({
logo: './src/logo.svg',
publicPath: process.env.WEBPACK_PUBLIC_PATH ?? '/',
prefix: 'auto/[contenthash]'
})
]
};