Make two files instead of three
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- build-system, tooling
Direzione di ricerca
Inizia con il comando factor-bundle mostrato nell’issue e riproducilo usando lib.js, main.js e checkout.js. Traccia il modo in cui il comando gestisce i bundle condiviso e di ingresso; il completamento consiste nel generare i bundle richiesti del sito e del checkout senza richiedere ./main né produrre junk.js.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hey!
I effectively want to split out part of a file, instead of splitting out the common parts of two files.
Currently I have bundle.js, which contains everything used on the site. There is some checkout specific logic there that I only want on the checkout, so I want to split that stuff out into bundle-checkout.js, but then run both bundle.js and bundle-checkout.js in the checkout.
With factor-bundle by default, I would be running these files on the main site:
- bundle-common.js
- bundle.js
And these on the checkout:
- bundle-common.js
- bundle.js
- bundle-checkout.js
It's pointless for me to have both bundle-common.js and bundle.js!
The best solution I've found so far is to add require('./main') to the top of the input bundle-checkout.js, which would mean that bundle.js is effectively an empty file and I can include bundle-common.js by itself, but then that generates a junk file.
lib.js:
module.exports = 'lib';
main.js:
var lib = require('./lib');
console.log(lib);
checkout.js:
require('./main');
console.log('special checkout logic');
And then the command:
browserify main.js checkout.js -p [ factor-bundle -o junk.js -o bundle-checkout.js ] -o bundle.js
Is there any way to do this without the require('./main') and the useless junk.js file?
Thanks, and sorry for the long question! I'll turn this into an article once it's been figured out so that nobody asks it again :)
- Lingua principale
- JavaScript
- Stelle
- 397
- Fork
- 24
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di browserify/factor-bundle
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
browserify/factor-bundle#95 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
browserify/factor-bundle#94 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
browserify/factor-bundle#92 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
browserify/factor-bundle#83 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
browserify/factor-bundle#82 · 3 reazioni ·
Tutte le issue di browserify/factor-bundle
Issue simili
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/safe-publish#594 ·
-
内部文件键(绝对路径的 base64)泄漏到界面标签 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
dream-num/dsh-univer-office#104 ·
-
comp/dashboard invalid P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
NousResearch/hermes-agent#121143 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
avniproject/avni-webapp#1811 ·
-
area/auroraboot area/webui bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100