personal-website/front/webpack.config.cjs
2023-07-19 04:06:13 +03:00

80 lines
1.9 KiB
JavaScript

// Generated using webpack-cli https://github.com/webpack/webpack-cli
const path = require('path');
const isProduction = process.env.NODE_ENV == 'production';
const stylesHandler = 'style-loader';
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { experiments } = require('webpack');
const config = {
// entry: [ './src/wde-mobile.js'],
entry: {
desktop:[
'./src/wde/wde-desktop.js',
],
desktop_style: [
"./src/desktop.less",
],
finder : [
'./src/apps/finder/finder.js',
],
finder_style:[
'./src/apps/finder/finder.less',
]
},
output: {
// path: path.resolve(__dirname, 'dist'),
path: path.resolve('../res/dev-fs/dist'),
filename: '[name].js',
library: {
type: "module",
},
},
experiments: {
outputModule: true,
},
devServer: {
open: true,
host: 'localhost',
},
plugins: [new MiniCssExtractPlugin()],
module: {
rules: [
{
test: /\.(js|jsx)$/i,
loader: 'babel-loader',
},
{
test: /\.css$/i,
use: [stylesHandler,'css-loader'],
},
{
test: /\.less$/i,
// use: [stylesHandler, 'css-loader', 'less-loader'],
use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader'],
},
{
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
type: 'asset',
},
// Add your rules for custom modules here
// Learn more about loaders from https://webpack.js.org/loaders/
],
},
};
module.exports = () => {
if (isProduction) {
config.mode = 'production';
} else {
config.mode = 'development';
}
return config;
};