Skip to content

Commit

Permalink
Конфигурация Webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
YOKAICODE committed Aug 16, 2022
1 parent 695ccaf commit 191fd98
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Thumbs.db
node_modules/

# Собранные файлы (допишите самостоятельно)
build/
5 changes: 5 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-env"
]
}
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"private": true,
"description": "Проект «Большое путешествие (простой)» от HTML Academy",
"scripts": {
"start": "webpack serve --mode development --open",
"build": "webpack --mode production",
"lint": "eslint src/"
},
"devDependencies": {
Expand All @@ -26,5 +28,12 @@
"dayjs": "1.11.3",
"flatpickr": "4.6.13",
"he": "1.2.0"
}
},
"browserslist": [
"last 2 versions",
"not dead",
"not IE <= 11",
"not op_mini all",
"not < 0.25%"
]
}
35 changes: 35 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// path — встроенный в Node.js модуль
const path = require('path')
const CopyPlugin = require("copy-webpack-plugin");

module.exports = {
// Указываем путь до входной точки:
entry: './src/main.js',
// Генерация sourcemap
devtool: 'source-map',
// Описываем, куда следует поместить результат работы:
output: {
// Путь до директории (важно использовать path.resolve):
path: path.resolve(__dirname, 'build'),
// Имя файла со сборкой:
filename: 'bundle.js',
// Опция очистки директории для сборки перед новой сборкой
clean: true,
},
plugins: [
new CopyPlugin({
patterns: [
{ from: `${path.resolve(__dirname, 'public')}`, to: `${path.resolve(__dirname, 'build')}` },
],
}),
],
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: ['babel-loader']
}
]
}
}

0 comments on commit 191fd98

Please sign in to comment.