-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.webpack.config.js
47 lines (45 loc) · 1.03 KB
/
demo.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
// This config is basically copy-pasted from https://dev.to/alekseiberezkin/setting-up-react-typescript-app-without-create-react-app-oph.
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtracePlugin = require('mini-css-extract-plugin')
const CopyPlugin = require('copy-webpack-plugin')
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: './demo/index.tsx',
output: {
path: `${__dirname}/_demo/`,
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
},
use: 'ts-loader',
},
{
test: /\.css$/,
use: [MiniCssExtracePlugin.loader, 'css-loader'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './demo/index.html',
}),
new MiniCssExtracePlugin(),
new CopyPlugin({
patterns: [
'./demo/vanilla.html',
'./demo/style.css',
'./lib.js',
],
}),
],
devServer: {
static: {
directory: `${__dirname}/demo/public/`,
},
},
}