-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
80 lines (76 loc) · 2.43 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
72
73
74
75
76
77
78
79
80
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const env = process.env.NODE_ENV || 'development';
module.exports = {
mode: env,
devtool: 'eval-source-map',
entry: path.resolve(__dirname, 'app/index.ts'),
output: {
path: path.resolve(__dirname, 'build'),
filename: 'editor.[hash:8].js',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
/*exclude: /node_modules/,
include: [
path.resolve(__dirname, 'app')
],*/
},
{
test: /\.scss$/,
use: [
{
loader: 'style-loader'
},
{
loader: MiniCssExtractPlugin.loader
},
{
loader: 'css-loader',
},
{
loader: 'sass-loader'
}
]
}
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {
'@abstract': path.resolve(__dirname, 'app/_abstract'),
'@components': path.resolve(__dirname, 'app/components'),
'@modules': path.resolve(__dirname, 'app/modules'),
'@redux': path.resolve(__dirname, 'app/redux'),
'@utils': path.resolve(__dirname, 'app/utils'),
'@commands': path.resolve(__dirname, 'app/commands.ts'),
'@interfaces': path.resolve(__dirname, 'app/interfaces.ts'),
'@plugins': path.resolve(__dirname, 'app/plugins.ts'),
'@schemas': path.resolve(__dirname, 'app/schemas.ts'),
'@typebehinds': path.resolve(__dirname, 'app/typebehinds.ts'),
},
},
plugins: [
new HtmlWebpackPlugin({
title: 'Notion-Editor',
filename: 'index.html',
inject: 'body',
hash: true,
template: path.resolve(__dirname, 'index.html')
}),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[name].[contenthash].css'
})
],
devServer: {
contentBase: path.join(__dirname, 'build'),
compress: true,
port: 9078,
hot: true
}
};