Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@
"browser-sync": "2.27.7",
"browser-sync-webpack-plugin": "2.3.0",
"browserslist": "4.18.1",
"clean-webpack-plugin": "1.0.1",
"clean-webpack-plugin": "4.0.0",
"create-pwa": "2.3.1",
"critical": "4.0.1",
"css-loader": "6.5.1",
"cssnano": "5.0.10",
"eslint": "8.2.0",
"eslint-config-recommended": "4.1.0",
"eslint-plugin-compat": "3.13.0",
"file-loader": "6.2.0",
"mini-css-extract-plugin": "2.4.4",
"node-sass-magic-importer": "5.3.2",
"postcss": "8.3.11",
Expand Down
26 changes: 7 additions & 19 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const { ProvidePlugin } = require('webpack');
const SpritesmithPlugin = require('webpack-spritesmith');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const WebpackShellPlugin = require('webpack-shell-plugin-next');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

const { url, server, mode } = argv;
const sourceMap = {
Expand Down Expand Up @@ -87,7 +87,7 @@ const browserSyncConfig = {
};

const extractTextConfig = {
filename: 'dist/app.css'
filename: 'app.css'
};

const spritesmithConfig = {
Expand All @@ -106,9 +106,7 @@ const spritesmithConfig = {
};

const cleanConfig = {
verbose: false,
exclude: ['sprite.svg'],
allowExternal: true
cleanOnceBeforeBuildPatterns: ['**/*', '!sprite.svg']
};

const shellScripts = [];
Expand Down Expand Up @@ -140,8 +138,8 @@ module.exports = () => {
mode: mode,
entry: ['./assets/styles/main.scss', './assets/scripts/main.js'],
output: {
path: resolve(__dirname, './assets'),
filename: 'dist/app.js'
path: resolve(__dirname, './assets/dist'),
filename: 'app.js'
},
resolve: {
modules: ['node_modules', './assets/scripts', './assets/images/sprite']
Expand Down Expand Up @@ -180,17 +178,7 @@ module.exports = () => {
},
{
test: /\.(jpe?g|gif|png|svg|woff2?|ttf|eot|wav|mp3|mp4)(\?.*$|$)/,
use: [
{
loader: 'file-loader',
options: {
name: '[hash].[ext]',
context: '',
publicPath: './',
outputPath: './dist/'
}
}
]
type: 'asset/resource'
}
]
},
Expand All @@ -202,7 +190,7 @@ module.exports = () => {
}),
new MiniCssExtractPlugin(extractTextConfig),
new SpritesmithPlugin(spritesmithConfig),
new CleanWebpackPlugin(['../assets/dist/'], cleanConfig),
new CleanWebpackPlugin(cleanConfig),
new WebpackShellPlugin({
onBuildStart: {
scripts: shellScripts
Expand Down
Loading