Skip to content

Commit

Permalink
Add webpack.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullahBakir97 authored May 27, 2024
1 parent ec9c36e commit 374624a
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions project-frontend/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const path = require('path');
const webpack = require('webpack');

module.exports = {
entry: './src/main.js', // Entry point of your application
output: {
path: path.resolve(__dirname, 'dist'), // Output directory
filename: 'bundle.js' // Output file name
},
resolve: {
extensions: ['.js', '.vue', '.json'], // Resolve these extensions
alias: {
'@': path.resolve(__dirname, 'src'), // Alias for the src directory
},
fallback: {
"fs": false, // Node modules that are not needed in the browser
"path": require.resolve("path-browserify"),
"os": require.resolve("os-browserify/browser")
}
},
module: {
rules: [
{
test: /\.vue$/, // Handle .vue files
loader: 'vue-loader'
},
{
test: /\.js$/, // Handle .js files
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/, // Handle .css files
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpg|gif|svg)$/, // Handle image files
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
plugins: [
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
devServer: {
static: {
directory: path.join(__dirname, 'public'), // Serve static files from public directory
},
historyApiFallback: true, // Serve index.html for all 404 errors (for Vue Router)
port: 8080,
hot: true, // Enable Hot Module Replacement
},
devtool: 'source-map', // Enable source maps for better debugging
};

0 comments on commit 374624a

Please sign in to comment.