Bon, je dois refaire du Webpack pour mettre à jour le build d'un tool de la boite. Comme j'ai eu beaucoup de peine à retrouver comment et quoi faire, voici un bref résumé des trucs et astuces à connaître sur Webpack.
Comment concaténer des fichiers JS inter-dépendants ?
Principe : mon fichier JS (Main.js) importe d'autres fichiers JS (cf. le mot-clef require de TypeScript / ES6). Et ces fichiers JS importent également d'autres fichiers. L'idée ici est d'avoir un Webpack qui parcours le graphe des dépendances en analysant le code afin de produire un et un seul fichier JS qui n'inclut que ce dont mon application se sert.
Contenu du fichier webpack.conf.js :
module.exports = {
entry: {
Car : './src/Main.js' // Charge ce fichier ainsi que tous ceux dont il dépend via le mot-clef 'require'.
},
output: {
path: './target',
filename: 'merged-file.js'
}
};
Comment créer un bundle de fichiers JS qui n'ont aucune dépendance entre-eux ?
Principe : j'ai plein de libs écrites en JavaScript avec mes petites mimines (ou pas), ces librairies n'ont aucune dépendance entre-elles, cependant je souhaiterais les concaténer dans un gros bundle de sorte à minimiser le nombre de requêtes réseau.
Contenu du fichier webpack.conf.js :
module.exports = {
entry: [
'./src/Car.js', // La liste des fichiers à concaténer
'./src/Vehicule.js'
],
output: {
path: './target',
filename: 'merged-file.js'
}
};
Comment créer plusieurs bundles de fichiers JS qui n'ont aucune dépendance entre-eux ?
Principe : je reprends les fichiers JS du point précédent à ceci près que je souhaite créer plusieurs bundles, un pour chaque types de véhicules par exemple.
Contenu du fichier webpack.conf.js :
module.exports = {
entry: {
four-wheels : [
'./src/Car.js',
'./src/Vehicule.js'
],
two-wheels : [
'./src/Bike.js',
'./src/Vehicule.js'
]
},
output: {
path: './target',
filename: '[name].bundle.js',
chunkFilename : '[id].bundle.js'
}
};
Comment minifier mes bundles JS ?
Principe : mes fichiers JS sont gros et je souhaite supprimer le maximum d'espace, les commentaires, réduire le nom des fonctions, variables & Co de sorte à fournir le plus petit fichier possible.
Contenu du fichier webpack.conf.js :
var webpack = require("webpack");
module.exports = {
entry: [
'./src/Car.js',
'./src/Vehicule.js'
],
output: {
path: './target',
filename: 'app.minified.js'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({minimize: true})
]
};Le problème vient du power management de la carte (me concernant), en effet l'énergumène s'attelait à passer la carte en mode économie d'énergie - ce qui est une très bonne chose pour la batterie de mon ordinateur portable - sauf que le power management exécute cette opération aussitôt que la connexion wifi est inactive et met plusieurs minutes à renvoyer le courant électrique dans la carte wifi de telle sorte qu'il faille redémarrer la bête (ou a minima les modules network-manager & co). Bref inutilisable.
Voici la solution qui réduit le temps d'usage sur batterie mais corrige le problème :
sudo iwconfig wlp2s0 power off
Voilà
Mais qui s'appuie sur Google.
JavaScript, a cause notamment ses nombreuses erreurs de conception, permet de coder dans une syntaxe turing complète avec 6 caractères seulement : ( ) [ ] + et !
Ou comment uglifer votre code de manière extraordinaire.
Tout est dans le titre. Voici comment l'union européenne est en train de nous manger via la privatisation des services publics
Oh tiens... Sans le vote utile c'est Mélenchon qui aurait gagné... Tiens tiens tiens
Vous avez cru jusqu'à ce jour qu'il y avait des tyrans ?
Et bien vous vous êtes trompés !
Il n'y a que des escalves : là ou nul n'obëit, personne ne commande.
Anselme BELLEGARRIGUE
Le "vrai" programme de Macron... Tiens ça me rappelle la stratégie de la Blitzkrieg de Fillon...
Pour toi Animal
Comment ajouter une icône "Afficher le Bureau" sous Windows 7. Voici le [lien direct}(https://www.sevenforums.com/attachments/tutorials/57574d1269652692-show-desktop-shortcut-create-show_desktop.zip)
Le groupe fait du Kawaï-Metal... Voilà que je vire otak' moi.
Mistigune est sympa, je vais écouter les autres chansons.
Une info complémentaire, si tous tes répos Git sont accessibles avec le même mot de passe, tu peux taper ceci à la place :
git config --global credential.helper storeLa liste complète des mots-clefs de NetBeans pour fabriquer vos macros :
abbrev-debug-line Debug Filename and Line Number
adjust-caret-bottom Move Insertion Point to Bottom
adjust-caret-center Move Insertion Point to Center
adjust-caret-top Move Insertion Point to Top
adjust-window-bottom Scroll Insertion Point to Bottom
adjust-window-center Scroll Insertion Point to Center
adjust-window-top Scroll Insertion Point to Top
all-completion-show Show All Code Completion Popup
annotations-cycling Annotations Cycling
beep Beep
build-popup-menu Build Popup Menu
build-tool-tip Build Tool Tip
caret-backward Insertion Point Backward
caret-begin Insertion Point to Beginning of Document
caret-begin-line Insertion Point to Beginning of Text on Line
caret-begin-word Insertion Point to Beginning of Word
caret-down Insertion Point Down
caret-end Insertion Point to End of Document
caret-end-line Insertion Point to End of Line
caret-end-word Insertion Point to End of Word
caret-forward Insertion Point Forward
caret-line-first-column Insertion Point to Beginning of Line
caret-next-word caret-next-word
caret-previous-word caret-previous-word
caret-up Insertion Point Up
collapse-all-code-block-folds Collapse All Java Code
collapse-all-folds Collapse All
collapse-all-javadoc-folds Collapse All Javadoc
collapse-fold Collapse Fold
comment Comment
complete-line Complete Line
complete-line-newline Complete Line and Create New Line
completion-show Show Code Completion Popup
copy-selection-else-line-down Copy Selection else Line down
copy-selection-else-line-up Copy Selection else Line up
copy-to-clipboard Copy
cut-to-clipboard Cut
cut-to-line-begin Cut from Insertion Point to Line Begining
cut-to-line-end Cut from Insertion Point to Line End
default-typed Default Typed
delete-next Delete Next Character
delete-previous Delete Previous Character
documentation-show Show Documentation Popup
dump-view-hierarchy Dump View Hierarchy
expand-all-code-block-folds Expand All Java Code
expand-all-folds Expand All
expand-all-javadoc-folds Expand All Javadoc
expand-fold Expand Fold
fast-import Fast Import
find-next Find Next Occurrence
find-previous Find Previous Occurrence
find-selection Find Selection
first-non-white Go to First Non-whitespace Char
fix-imports Fix Imports
format Format
generate-code Insert Code
generate-fold-popup Generate Fold Popup
generate-goto-popup Generate Goto Popup
generate-gutter-popup Margin
goto Go to Line...
goto-declaration Go to Declaration
goto-help Go to Javadoc
goto-implementation Go to Implementation
goto-source Go to Source
goto-super-implementation Go to Super Implementation
in-place-refactoring Instant Rename
incremental-search-backward Incremental Search Backward
incremental-search-forward Incremental Search Forward
insert-break Insert Newline
insert-date-time Insert Current Date and Time
insert-tab Insert Tab
introduce-constant Introduce Constant...
introduce-field Introduce Field...
introduce-method Introduce Method...
introduce-variable Introduce Variable...
java-next-marked-occurrence Navigate to Next Occurrence
java-prev-marked-occurrence Navigate to Previous Occurrence
jump-list-last-edit Last edit
jump-list-next Forward
jump-list-prev Back
last-non-white Go to Last Non-whitespace Char
make-getter Replace Variable With its Getter
make-is Replace Variable With its is* Method
make-setter Replace Variable With its Setter
match-brace Insertion Point to Matching Brace
move-selection-else-line-down Move Selection else Line down
move-selection-else-line-up Move Selection else Line up
org.openide.actions.PopupAction Show Popup Menu
page-down Page Down
page-up Page Up
paste-formated Paste Formatted
paste-from-clipboard Paste
redo Redo
reindent-line Re-indent Current Line or Selection
remove-line Delete Line
remove-line-begin Delete Preceding Characters in Line
remove-selection Delete Selection
remove-tab Delete Tab
remove-trailing-spaces Remove Trailing Spaces
remove-word-next remove-word-next
remove-word-previous remove-word-previous
replace Replace
run-macro Run Macro
scroll-down Scroll Down
scroll-up Scroll Up
select-all Select All
select-element-next Select Next Element
select-element-previous Select Previous Element
select-identifier Select Identifier
select-line Select Line
select-next-parameter Select Next Parameter
select-word Select Word
selection-backward Extend Selection Backward
selection-begin Extend Selection to Beginning of Document
selection-begin-line Extend Selection to Beginning of Text on Line
selection-begin-word Extend Selection to Beginning of Word
selection-down Extend Selection Down
selection-end Extend Selection to End of Document
selection-end-line Extend Selection to End of Line
selection-end-word Extend Selection to End of Word
selection-first-non-white Extend Selection to First Non-whitespace Char
selection-forward Extend Selection Forward
selection-last-non-white Extend Selection to Last Non-whitespace Char
selection-line-first-column Extend Selection to Beginning of Line
selection-match-brace Extend Selection to Matching Brace
selection-next-word selection-next-word
selection-page-down Extend Selection to Next Page
selection-page-up Extend Selection to Previous Page
selection-previous-word selection-previous-word
selection-up Extend Selection Up
shift-line-left Shift Line Left
shift-line-right Shift Line Right
split-line Split Line
start-macro-recording Start Macro Recording
start-new-line Start New Line
stop-macro-recording Stop Macro Recording
switch-case Switch Case
to-lower-case To Lowercase
to-upper-case To Uppercase
toggle-case-identifier-begin Switch Capitalization of Identifier
toggle-comment Toggle Comment
toggle-highlight-search Toggle Highlight Search
toggle-line-numbers Toggle Line Numbers
toggle-non-printable-characters Toggle Non-printable Characters
toggle-toolbar Toggle Toolbar
toggle-typing-mode Toggle Typing Mode
tooltip-show Show Code Completion Tip Popup
uncomment Uncomment
undo Undo
word-match-next Next Matching Word
word-match-prev Previous Matching WordTout est dans le titre.
Moi j'aurai donné en exemple cette commande :
sudo yum install nano
Enfin je dis ça, ne dit rien...
Animal... Ce post est tristement pour toi (il parle des panneaux publicitaires vidéos en plein rue).