mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const webpack = require('webpack');
|
|
|
|
module.exports = (env, argv) => {
|
|
const isProduction = argv.mode === 'production';
|
|
|
|
return {
|
|
entry: './src/index.js',
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'bundle.js',
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
exclude: /node_modules/,
|
|
use: ['babel-loader'],
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['style-loader', 'css-loader'],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: './public/index.html',
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
'window.API_BASE_URL': JSON.stringify(
|
|
isProduction ? '/api/v1' : 'http://localhost:8080/api/v1'
|
|
),
|
|
}),
|
|
],
|
|
devServer: {
|
|
static: {
|
|
directory: path.join(__dirname, 'public'),
|
|
},
|
|
port: 3000,
|
|
open: true,
|
|
},
|
|
};
|
|
};
|