-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.base.js
55 lines (54 loc) · 1.52 KB
/
webpack.config.base.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
const path = require('path')
const static_files = './airsift/static'
const bundle_dir = path.join(static_files, 'webpack_bundles/')
const BundleTracker = require('webpack-bundle-tracker');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
/** @type {import('webpack').Configuration} */
module.exports = {
context: __dirname,
entry: path.join(__dirname, static_files, "index.tsx"),
output: {
path: path.join(__dirname, bundle_dir),
filename: "[name]-[hash].js"
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json', '.css']
},
plugins: [
new CleanWebpackPlugin(),
new BundleTracker({ filename: path.join(bundle_dir, 'webpack-stats.json') }),
new MiniCssExtractPlugin({
filename: '[name]-[hash].css',
}),
],
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.css$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
require('postcss-css-variables')(),
require('tailwindcss')(path.resolve(__dirname, './tailwind.config.js')),
require('postcss-nested')(),
require('autoprefixer'),
],
},
},
},
],
},
],
},
};