Добрый день есть сборка webpack в проекте,
файлы продакшн находятся на 4 папки вверх
/public_html/assets/js/app.js
/public_html/assets/css/styles.css
проблема что при build не перезаписываются app.js и styles.css и сообветственно не попадают в коммит
редактор php storm
конфига
let path = require('path');
let webpack = require('webpack');
let globImporter = require('node-sass-glob-importer');
let autoprefixer = require('autoprefixer');
let postcssclick = require('postcss-click');
let backgroundSvg = require('postcss-encode-background-svgs');
let cssnext = require('postcss-preset-env');
let animation = require('postcss-animation');
let TerserJSPlugin = require('terser-webpack-plugin');
let MiniCssExtractPlugin = require('mini-css-extract-plugin');
let OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
let conf = {
mode: 'production',
entry: './index.js',
output: {
path: path.resolve(__dirname, '../../../../public_html/assets/'),
filename: './js/app.js'
},
optimization: {
minimizer: [new TerserJSPlugin({}), new OptimizeCSSAssetsPlugin({})],
},
devServer: {
overlay: true,
port: 3010
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: "/node_modules/",
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.(sa|sc|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
sourceMap: true,
url:false,
}
},
{
loader: 'postcss-loader',
options: {
plugins: [
postcssclick(),
cssnext(),
animation()
],
sourceMap: true,
}
},
{
loader: 'sass-loader',
options: {
sassOptions: {
importer: globImporter(),
sourceMap: true,
}
}
}
],
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '/css/styles.css',
})
]
};
module.exports = conf;