-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack-config.js
53 lines (46 loc) · 1.4 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
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './src/styles/styles.css', // Entry point for CSS
output: {
path: path.resolve(__dirname, '/public/css'), // Output CSS to 'public/css'
filename: 'dummy.js', // Webpack requires a JS file; this can be ignored
},
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader', // Process TailwindCSS
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: 'styles.css', // Output CSS file in 'public/css'
}),
],
devServer: {
static: {
directory: path.join(__dirname, 'public'), // Serve from 'public' directory
},
proxy: {
'/api': 'http://localhost:3000', // Proxy API calls to the backend running on port 3000
},
compress: true,
port: 8080,
hot: true,
open: true,
},
};
// Custom Logging
console.log('Webpack config loaded successfully!');
console.log('Current working directory:', process.cwd());
console.log('PostCSS config path:', path.resolve(__dirname, 'postcss.config.js'));
// Log output directory
console.log('Output will be written to:', path.resolve(__dirname, 'public/js'));
// Log CSS output location
console.log('CSS will be extracted to:', path.resolve(__dirname, 'public/css/styles.css'));