2020-06-10 15:20:46 +03:00
|
|
|
const path = require('path')
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
|
|
const devMode = (process.env.NODE_ENV !== 'production')
|
|
|
|
const CopyPlugin = require('copy-webpack-plugin');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
|
|
|
entry: [
|
|
|
|
'./js/script.js',
|
2020-11-07 11:40:32 +02:00
|
|
|
'./scss/style.scss'
|
2020-06-10 15:20:46 +03:00
|
|
|
],
|
|
|
|
plugins: [
|
2021-08-14 09:58:24 +03:00
|
|
|
new MiniCssExtractPlugin(),
|
2020-06-10 15:20:46 +03:00
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
{ from: './html/', to: '' },
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.m?js$/,
|
|
|
|
exclude: /(node_modules)/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
presets: ['@babel/preset-env']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.s[ac]ss$/i,
|
|
|
|
use: [
|
2021-08-14 09:58:24 +03:00
|
|
|
MiniCssExtractPlugin.loader,
|
2020-06-10 15:20:46 +03:00
|
|
|
// Translates CSS into CommonJS
|
|
|
|
'css-loader',
|
|
|
|
'postcss-loader',
|
|
|
|
// Compiles Sass to CSS
|
|
|
|
'sass-loader'
|
|
|
|
]
|
2020-11-07 11:40:32 +02:00
|
|
|
},
|
2020-06-10 15:20:46 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, 'build')
|
|
|
|
}
|
|
|
|
}
|