Mam taki plik webpack.config.js
module.exports = {
entry: './src/js/app.js',
mode: 'development',
output: {
path: `${__dirname}/public/js`,
filename: 'bundle.js',
},
};
strukture katalogów:
public>css(style.min.css),(style.min.css.map)js(bundle.js)
src>css,fonts,img,js(app.js,main.js,script.js),scss
plik bundle
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/js/main.js":
/*!************************!*\
!*** ./src/js/main.js ***!
\************************/
/***/ (() => {
eval("$(function(){\r\n var $readMoreLink = $(\".read-more\");\r\n\r\n $readMoreLink.on(\"click\", function(e){\r\n e.preventDefault();\r\n $(this).parent().next(\"div\").show();\r\n $(this).remove();\r\n });\r\n});\r\n\n\n//# sourceURL=webpack://xyz/./src/js/main.js?");
/***/ })
/******/ });
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./src/js/main.js"]();
/******/
/******/ })()
;
app.js
require('./main.js'),
require('./script.js')
Dlaczego po wydaniu komendy npm run build, kompiluje mi się tylko ten pierwszy main.js