This repository has been archived by the owner on Dec 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.js
78 lines (77 loc) · 2.38 KB
/
webpack.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
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const {
styles
} = require('@ckeditor/ckeditor5-dev-utils')
module.exports = {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: __dirname + '/dist/'
},
context: path.resolve(__dirname, './src'),
entry: './index.tsx',
output: {
path: path.resolve(__dirname, './dist/'),
publicPath: '/',
filename: 'bundle.js'
},
module: {
rules: [{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader'
},
// {
// // TODO: find a better regex
// test: /(\.(jpg|png|eot|woff|woff2|ttf)|icomoon.svg)$/,
// loader: 'file-loader'
// },
// {
// test: /\.json$/,
// loader: 'json-loader'
// },
{
// TODO: find a better regex => /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/ this one isn't working properly
test: /\.svg$/,
use: ['svg-inline-loader']
},
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader'],
include: path.resolve(__dirname, './src')
},
{
test: /\.css$/,
use: [{
loader: 'style-loader',
options: {
singleton: true
}
},
{
loader: 'postcss-loader',
options: styles.getPostCssConfig({
themeImporter: {
themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
},
minify: true
})
},
]
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss', '.png'],
alias: {
assets: path.resolve(__dirname, './src/')
}
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './index.html')
})
]
}