Answer the question
In order to leave comments, you need to log in
How to fix this in gulpe`?
After the gulp command, it collects files somehow crookedly. Please help me figure it out.
The structure is as follows:
js folder
-app.js
-modules folder
- function.js
- sliders.js
- webp.js
In gulp, the configuration is to collect it in a single file.
import webpack from "webpack-stream";
export const js = () => {
return app.gulp.src(app.path.src.js, { sourcemaps: app.isDev })
.pipe(app.plugins.plumber(
app.plugins.notify.onError({
title: "JS",
message: "Error: <%= error.message %>"
}))
)
.pipe(webpack({
output: {
filename: 'scripts.js',
},
module: {
rules: [{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
targets: "defaults"
}]
]
}
}
}]
},
devtool: !app.isBuild ? 'source-map' : false
}))
.on('error', function (err) {
console.error('WEBPACK ERROR', err);
this.emit('end');
})
.pipe(app.gulp.dest(app.path.build.js))
.pipe(app.plugins.browsersync.stream());
}
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/js/modules/functions.js":
/*!*************************************!*\
!*** ./src/js/modules/functions.js ***!
\*************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "isWebp": () => (/* binding */ isWebp)
/* harmony export */ });
/* Проверка поддержки webp, добавление класса webp или no-webp для HTML */
//Далее получаю чистый js без всяких примесей.
// скрипты из function.js
// скрипты из sliders.js
// скрипты из webp.js
Answer the question
In order to leave comments, you need to log in
mode
mode: !app.isBuild ? 'development' : 'production',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question