-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
74 lines (71 loc) · 1.74 KB
/
webpack.config.ts
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
import path from 'path';
import webpack, { Configuration as WebpackConfiguration } from 'webpack';
import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
interface Configuration extends WebpackConfiguration {
devServer: WebpackDevServerConfiguration;
}
const config: Configuration = {
context: path.join(__dirname, 'src'),
entry: {
styled: ['styled-components'],
app: './index.tsx',
'editor.worker': 'monaco-editor/esm/vs/editor/editor.worker.js',
'json.worker': 'monaco-editor/esm/vs/language/json/json.worker',
'css.worker': 'monaco-editor/esm/vs/language/css/css.worker',
'html.worker': 'monaco-editor/esm/vs/language/html/html.worker',
'ts.worker': 'monaco-editor/esm/vs/language/typescript/ts.worker'
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name]-[fullhash].js',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.ttf$/,
type: 'asset/resource'
},
{
test: /\.(png|jpg)$/,
type: 'asset/resource'
},
{
test: /\.md$/,
type: 'asset/source'
}
],
},
mode: "development",
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
plugins: [
new webpack.optimize.SplitChunksPlugin({
name: 'styled',
minChunks: Infinity
}),
new HtmlWebpackPlugin({
template: '../public/index.html'
}),
new MonacoWebpackPlugin({
languages: ["javascript", "typescript"]
})
],
devtool: "inline-source-map",
devServer: {
contentBase: path.join(__dirname, 'public'),
open: true,
port: 3000,
},
};
export default config;