-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathwebpack.config.js
96 lines (95 loc) · 2.18 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const EslintWebpackPlugin = require('eslint-webpack-plugin')
const ip = require('ip')
module.exports = {
mode: 'development',
devtool: process.env.NODE_ENV === 'production' ? undefined : 'cheap-module-source-map',
entry: {
index: path.resolve(__dirname, './index.tsx')
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name]_[hash:8].js',
publicPath: '/'
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
'@textbus/xnote': path.resolve(__dirname, './src/public-api.ts'),
}
},
devServer: {
host: ip.address(),
historyApiFallback: true,
static: {
directory: path.join(__dirname, 'public')
},
compress: true,
port: 5636,
hot: true,
open: true
},
module: {
rules: [{
test: /\.tsx?$/,
use: [{
loader: 'ts-loader',
}]
}, {
test: /\.s?css$/,
use: ['style-loader', '@viewfly/devtools/scoped-css-webpack-loader', {
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
[
'postcss-preset-env',
{
// Options
},
],
[
'autoprefixer'
]
],
}
}
}, 'sass-loader'],
}, {
test: /\.less$/,
use: ['style-loader', '@viewfly/devtools/scoped-css-webpack-loader', {
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
[
'postcss-preset-env',
{
// Options
},
],
[
'autoprefixer'
]
],
}
}
}, 'less-loader'],
}, {
test: /\.(jpe?g|png|svg|gif)$/,
type: 'asset'
}]
},
plugins: [
new EslintWebpackPlugin({
context: __dirname,
extensions: ['.ts', '.tsx']
}),
new HtmlWebpackPlugin({
template: './public/index.html',
publicPath: '/',
favicon: './public/favicon.ico'
})
]
}