-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
74 lines (72 loc) · 2.17 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const postcss_prefix_selector = require("postcss-prefix-selector");
module.exports = {
entry: {
main: './src/index.tsx'
},
output: {
path: path.join(__dirname, 'dist/l/'),
filename: '[name].bundle.js',
},
watch: true,
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
devServer: {
contentBase: path.join(__dirname, '../dist/'),
port: 2222
},
devtool: 'inline-source-map',
module: {
rules: [
{ test: /.tsx?$/, use: ['awesome-typescript-loader'] },
{ test: /.html$/, use: 'raw-loader' },
{ test:/\.(s*)css$/, use:['style-loader','css-loader', 'sass-loader' , {
loader: "postcss-loader",
options: {
plugins: () => [
postcss_prefix_selector({
prefix: "#questionnaireRoot",
exclude: [
"&:after",
"&:before",
"&::after",
"&::before",
"&:nth-of-type",
"&:first-of-type",
"&:disabled",
"&:empty",
"&::placeholder",
"&:focus",
"&::-ms-input-placeholder",
"&:hover"
]
})
]
}
}] },
{ test: /\.woff(\?.+)?$/, use: 'url-loader?limit=10000&mimetype=application/font-woff' },
{ test: /\.woff2(\?.+)?$/, use: 'url-loader?limit=10000&mimetype=application/font-woff' },
{ test: /\.ttf(\?.+)?$/, use: 'file-loader' },
{ test: /\.eot(\?.+)?$/, use: 'file-loader' },
{ test: /\.svg(\?.+)?$/, use: 'svg-inline-loader' },
{ test: /\.png$/, use: 'url-loader?mimetype=image/png' },
{ test: /\.gif$/, use: 'url-loader?mimetype=image/gif' },
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/,
query: {
presets: ["@babel/env", "@babel/react"]
} }
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
showErrors: true,
title: 'React-TS-Webpack App',
path: path.join(__dirname, '../dist/'),
hash: true
})
]
}