bro.landing/ijl.config.js

89 lines
2.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* eslint-disable @typescript-eslint/no-require-imports */
/* eslint-disable no-undef */
const path = require('path');
const pkg = require('./package');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
const isProd = process.env.NODE_ENV === 'production';
module.exports = {
apiPath: 'stubs/api',
apps: {
main: {
version: 'master',
name: 'cleanName',
},
},
webpackConfig: {
entry: {
index: './src/index.tsx',
terms: './src/terms.js', // Entry для стилей terms
},
output: {
publicPath: isProd
? 'https://static.brojs.ru/landing/main/'
: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/`,
filename: '[name].js?[contenthash]',
},
module: {
rules: [
{
test: /\.module\.scss$/,
use: [
isProd ? MiniCssExtractPlugin.loader : 'style-loader',
{
loader: 'css-loader',
options: {
modules: {
localIdentName: isProd ? '[hash:base64:8]' : '[name]__[local]--[hash:base64:5]',
},
},
},
'sass-loader'
],
},
{
test: /\.scss$/,
exclude: /\.module\.scss$/,
use: [
isProd ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader',
'sass-loader'
],
},
],
},
plugins: [
// Главная страница (с React)
new HtmlWebpackPlugin({
template: './src/index.ejs',
filename: 'index.html',
chunks: ['index'],
}),
// Terms страница (статика + SCSS)
new HtmlWebpackPlugin({
template: './src/terms.html',
filename: 'terms.html',
chunks: isProd ? [] : ['terms'], // В production не нужен JS
cssPath: isProd
? 'https://static.brojs.ru/landing/main/terms.css'
: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/terms.css`,
}),
// Извлечение CSS в отдельные файлы для production
...(isProd ? [
new MiniCssExtractPlugin({
filename: '[name].css',
})
] : []),
new webpack.DefinePlugin({
IS_PROD: process.env.NODE_ENV === 'production',
}),
],
},
navigations: {},
features: {},
config: {},
};