- iPhone topik
- Xiaomi 14 - párátlanul jó lehetne
- Így lesz tégla a porszívódból - a Roidmi csődje
- Google Pixel 8 Pro - mestersége(s) az intelligencia
- Honor 400 Pro - Gép a képben
- Samsung Galaxy Z Fold7 - ezt vártuk, de…
- Android szakmai topik
- Huami Amazfit Bip okosóra
- Okosóra és okoskiegészítő topik
- Samsung Galaxy S23 FE - nincsen sárkány
Hirdetés
-
Mobilarena
JavaScript != Java (A JavaScript nem összekeverendő a Javával, két különböző programozási nyelvről van szó!)
Új hozzászólás Aktív témák
-
Jim-Y
veterán
Gondoltam megmutatom, hogy hogy működik a browserify, mert viszonylag egyszerűen be lehet mutatni:
Vannak a forrás fájlok:
.
├── app.js
├── index.html
├── module1.js
├── module2.js
└── node_modules
└── browserifymodule1
======='use strict';
module.exports.hello = function(world) {
return 'hello, ' + world();
};module2
======='use strict';
module.exports.world = function() {
return 'world!';
};app
==='use strict';
var module1 = require('./module1.js'),
module2 = require('./module2.js');
document.querySelector('body > div > p').innerText = module1.hello(module2.world);Majd itt használjuk fel a browserify-t egy bundle készítésre, terminálban a gyökér könyvtárban ki kell adni ezt a parancsot:
browserify app.js > bundle.js
index.html
========<!DOCTYPE html>
<head>
<title>Browserify</title>
</head>
<body>
<div>
<p></p>
</div>
<script src="bundle.js"></script>
</body>
</html>Tehát a html-be már csak a bundle-t húzzuk be, illetve a webszerverre/CDN-re is már csak a bundle-t kell feltenni.
A bundle pedig ezt tartalmazza:
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var module1 = require('./module1.js'),
module2 = require('./module2.js');
document.querySelector('body > div > p').innerText = module1.hello(module2.world);
},{"./module1.js":2,"./module2.js":3}],2:[function(require,module,exports){
'use strict';
module.exports.hello = function(world) {
return 'hello, ' + world();
};
},{}],3:[function(require,module,exports){
'use strict';
module.exports.world = function() {
return 'world!';
};
},{}]},{},[1]);Sok-sok olvashatatlan dolog, de látszik, hogy végső soron a te fájlaidat rakja össze.
Üdv -
Új hozzászólás Aktív témák
- laskr99: Processzor és videokártya szilícium mag fotók újratöltve!
- Folyószámla, bankszámla, bankváltás, külföldi kártyahasználat
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- TCL LCD és LED TV-k
- iPhone topik
- One otthoni szolgáltatások (TV, internet, telefon)
- Milyen légkondit a lakásba?
- Civilization VI
- Autós topik
- Tőzsde és gazdaság
- További aktív témák...
- Szuper áron DELL XPS 13 9380 /i7-/16 GB Ram/512 GB SSD 4K Touch/IPS/
- Apple Watch Ultra S1 49mm 1év garancia.
- Dell Latitude 7280, 12,5" FHD IPS, I5-7300U, 8GB DDR4, 256GB SSD, W11, Számla, 1 év garancia
- Dell Latitude 7280, 12,5" FHD IPS, I5-7300U, 8GB DDR4, 256GB SSD, W11, Számla, 1 év garancia ( olvas
- Dell Latitude 7280, 12,5" FHD IPS, I7-7600U, 8GB DDR4, 256GB SSD, W11, Számla, 1 év garancia
- Asus Zenbook 15 OLED UM3504 - 15.6" 2.8K 120Hz - Ryzen 5 7535U - 16GB - 512GB - 2+ év garancia
- Telefon felvásárlás!! iPhone 14/iPhone 14 Plus/iPhone 14 Pro/iPhone 14 Pro Max
- HUAWEI MateBook 13 2020 - Kijelző nélkül - I7-10510U - 16GB - 512GB SSD - Win11 - MAGYAR
- LG 40WP95XP-W - 40" NANO IPS - 5120x2160 5K - 72Hz 5ms - TB 4.0 - HDR - AMD FreeSync
- Akció! Gigabyte Vision Z590 D Wi-Fi Alaplap! LGA 1200!
Állásajánlatok
Cég: FOTC
Város: Budapest