My LIGHTWEIGHT build tooling setup

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • This week we are talking build tooling!
    Node: nodejs.org
    Rollup docs: rollupjs.org/g...
    Modules used: rollup, rollup-plugin-replace, rimraf
    npx: www.npmjs.com/...
    IIFEs: benalman.com/ne... (turns out it was 2010!)
    Http-server: www.npmjs.com/...
    Caches API: developer.mozi...
    And yep you can do const { version } = require("./package.json"); in the Rollup config, but, you know, code readability etc.

Комментарии • 123

  • @aerotwist
    @aerotwist  6 лет назад +7

    What up, team! Let's talk build tools. Drop your suggestions for everyone.

    • @GerardoOscarJT
      @GerardoOscarJT 6 лет назад

      Few years ago I tried to build a tool to solve typical web dev problems: a preprocessor github.com/hblend/hblend

    • @accionrebeldemusical5762
      @accionrebeldemusical5762 6 лет назад +1

      SWs please ^____^ workbox, i guess?

    • @wobble_cat
      @wobble_cat 5 лет назад +1

      Parcel is a great build tool with zero configuration. It does all your babel stuff by default, although it does not support webcomponents, so you need to include polyfills yourself

    • @emiremiroglu
      @emiremiroglu 5 лет назад

      Gonna be a bit cheezy but the best tooling is no tooling :)

  • @noureddine2228
    @noureddine2228 6 лет назад +35

    +1 for the advanced video

  • @dvidschmdt
    @dvidschmdt 6 лет назад +21

    Paul's a RUclips natural. Love it.

  • @Steve-Ariss
    @Steve-Ariss 6 лет назад +16

    Would love an episode on service workers and to see an advanced video of your tooling. Thanks!

  • @Chris2phaBrown
    @Chris2phaBrown 6 лет назад +9

    I want to see more about that caching stuff you were doing

  • @JamieNeubertPedersen
    @JamieNeubertPedersen 5 лет назад

    What is cool about npx is that the version of the depency is local to that project, so it is not a matter of how much you use roll-up but more a matter of having the version that works with your config for example. By the way love the videos

  • @bahatijustin
    @bahatijustin 6 лет назад +4

    Great Paul!
    Thank you for the video!
    Whating for a video on SW and offline tips!

  • @GodOfMacro
    @GodOfMacro 5 лет назад

    Haha loved the npm install montage Paul, this minimal, keep it simple kind of setups speak to my soul, i hope to see the javascript community thrive more toward this direction.
    Thanks for doing your part !

  • @mohamadtajjiou7508
    @mohamadtajjiou7508 6 лет назад +3

    Hi paul, we miss your live coding videos, can you please make a weekly series, we learn tons from you, thank you.

  • @dassurma
    @dassurma 6 лет назад +2

    Brace yourself: UNSOLICITIED SURMA CODE REVIEW
    - Don’t use npx in your npm scripts, you don’t need it (but if you do, declare it as a dependency)
    - I prefer cpx over rsync because you can declare it as a proper dependency
    My personal npm module go-tos:
    - npm-watch for that auto-rebuild goodness
    - rollup-plugin-terser for es6-compatible minification
    - rollup-plugin-loadz0r for code splitting that just works
    - husky to auto-install git commit hooks, so you can make sure your linter passes before you commit.

    • @aerotwist
      @aerotwist  6 лет назад

      Way to make it complicated [rolls eyes]
      Thanks Surma. No really. Thanks.

  • @bolivarlema
    @bolivarlema 6 лет назад +1

    This is great Paul!!! I learn so much with your videos.
    Please post the advanced video.

  • @TheNeonRaven
    @TheNeonRaven 5 лет назад

    One of the most informative JS videos I’ve seen in quite a while. Great video Paul, and thank you! :)

  • @MrHelmudt
    @MrHelmudt 6 лет назад +2

    This is great! can't wait to see the next one!

  • @GuilhermeScaldelai
    @GuilhermeScaldelai 6 лет назад

    Really cool Paul! I always thought that your tooling would be something so complex. It would be so helpful a video about the next steps and also about service worker. I really admire you, Surma and Jake for all your crazy skills!

    • @aerotwist
      @aerotwist  6 лет назад

      Don't get me wrong, complexity finds me like it finds all of us. I just try and fight back a little because otherwise, when it fails (it always does!), I waste a lot of time.

  • @thabangthamane8584
    @thabangthamane8584 5 лет назад

    I personally don't care about webpack vs rollup but this one time I tried to use a web assembly module in my js app but webpack couldn't compile it properly. That's when I realised that knowing both is a good idea(for me).

    • @aerotwist
      @aerotwist  5 лет назад +1

      Yeah if I could avoid build tools I would. Part of modern web dev tho

  • @vyacheslavpalamar1787
    @vyacheslavpalamar1787 6 лет назад +1

    Paul, thank you for your videos! Can't wait to see episode about SW :)

  • @pajotrus
    @pajotrus 5 лет назад

    coming from MPJ's channel and I like it so much here! great style of presentation, concise explanations and just your personality. and the video itself made me want to try rollup instead of webpack

  • @fhdhsni
    @fhdhsni 6 лет назад +10

    service worker please :)

  • @seanpheneger6632
    @seanpheneger6632 5 лет назад

    Gotta say, love the creative entro/outtro that you have in your videos...also, awesome content. Glad you collaborated with MPJ and I got exposed to your channel, immediately subscribed!

    • @aerotwist
      @aerotwist  5 лет назад +1

      Welcome! Thanks for coming by :)

  • @mauroreisvieira
    @mauroreisvieira 6 лет назад

    Nice video @Paul Lewis, in can change your config to: const { version } from './package.json'

    • @aerotwist
      @aerotwist  6 лет назад +1

      Of course! Great shout :)

  • @CoreyBurns
    @CoreyBurns 6 лет назад

    Awesome video Paul! Love the tip to tie the package version to the cache!

  • @yuyokk
    @yuyokk 6 лет назад

    Nice video! Waiting on the advanced video on build tooling setup now 🙌

  • @jani_fekete
    @jani_fekete 6 лет назад +1

    ++ for the next(advanced) version of build tooling
    rimraf 🤣😂

  • @ganeshk5374
    @ganeshk5374 6 лет назад

    Fantastic Paul, waiting for the advanced one👏👏👏

  • @johnwhitmore2531
    @johnwhitmore2531 6 лет назад

    Love your videos, and I see people asking about the advanced version, but man I need to get a book on node or something. I've never used it, and that seems to be your technology of choice.

    • @aerotwist
      @aerotwist  6 лет назад

      For builds it is, and a go-to for most folks in front end work. While it does have its own quirks, a good grasp of JavaScript will get you a long way.

  • @peripona
    @peripona 5 лет назад

    the best intri

  • @matheusdallrosa4698
    @matheusdallrosa4698 5 лет назад

    Don't you worry. I have read all the comments and there are more than 1000 people asking for service workers. I think you should do it.

  • @KevinSheppard
    @KevinSheppard 6 лет назад

    Rollup's pretty cool 🙂 I used it a couple times, but these days I'm giving Parcel a go. The no-config thing is 👌🏽but you can't do stuff like replace version numbers at build time. Also, I'm a glutton for service worker/caching stuff -- I watch from afar, but never actually put a SW into production -- so bring it on in the next video 😁

    • @aerotwist
      @aerotwist  6 лет назад

      Well it might not be the _next_ video... ;)

  • @DNABeast
    @DNABeast 6 лет назад

    Loving this stuff.

  • @michongoma7598
    @michongoma7598 6 лет назад

    So because i am lazy, i use polymer for most of my front-end work and just build with the polymer build tool. I like this way too though . . . Thanks! Can't wait to learn more.

    • @aerotwist
      @aerotwist  6 лет назад +1

      Nothing wrong with that! Whatever gets you shipping is 👍

  • @SAS-qq5ce
    @SAS-qq5ce 5 лет назад

    loved the web diary series you did on chrome dev. Would love to have more of those here.

  • @daslafdev
    @daslafdev 6 лет назад

    Yes please, advanced tooling

  • @crsten94
    @crsten94 6 лет назад

    Great show, Paul :) would love to see a code session where u are making nice and smooth animations with the FLIP method

    • @aerotwist
      @aerotwist  6 лет назад +1

      Funnily enough I will being doing that in the next video ... I think

  • @GerardoOscarJT
    @GerardoOscarJT 6 лет назад

    Keeping It simple? I can not wait for the complex versión :D

    • @aerotwist
      @aerotwist  6 лет назад

      I mean, yes? Hope it _was_ simple enough!

    • @GerardoOscarJT
      @GerardoOscarJT 6 лет назад

      @@aerotwist simple but frontend has a lot of accidental complexity, hundreds of dependencies (libraries, tools, services, tecnologies...)

    • @aerotwist
      @aerotwist  6 лет назад

      Agree, which is why I try and keep it minimal.

    • @GerardoOscarJT
      @GerardoOscarJT 6 лет назад

      @@aerotwist It is so hard having only one framework or a project layout... One year later It becomes obsolete.

    • @GerardoOscarJT
      @GerardoOscarJT 6 лет назад

      @@aerotwist btw, nice video

  • @alexnezhynsky9707
    @alexnezhynsky9707 5 лет назад

    Informative and entertaining, I like it! What about dev server with HMR in rollup? Also, doesn't the browser already cache img and other assets? Would be nice to see more on caching.

  • @ankeetmaini
    @ankeetmaini 6 лет назад

    Would love to see hashes, vendor chunk, done using Rollup!

  • @aniruddhadas9
    @aniruddhadas9 5 лет назад +1

    one video on the cache

  • @andersonprante2964
    @andersonprante2964 5 лет назад

    More more more videos like this!!!!

  • @saeedjama100
    @saeedjama100 6 лет назад +1

    Can't stand the open editors pane you can hide with "explorer.openEditors.visible": 0,

  • @brorentilhammad
    @brorentilhammad 6 лет назад

    You said A, now you have to say B (Don´t know if the saying is the same in english as norwegian :P), but, yeah, please do the tooling next steps video. And also service worker one. We want all of it! :)

    • @aerotwist
      @aerotwist  6 лет назад

      I guess the equivalent is "I've started so I'll finish"? :)

  • @liqudtags
    @liqudtags 5 лет назад

    When’s the XHTML tutorial coming Paul?

  • @MichaelSchillingNL
    @MichaelSchillingNL 6 лет назад

    Great video, Paul! Great to see what you did with bumping the package version (I do remember you and Jake did something similar in the 'Big Web Quiz' repo. Question do: let's say you want to ship every patch/minor/major, how do you usually follow up? For example, the manual way: zip the dist folder and add it to GitHub as a release. Anything you can recommend on the 'shipping' part?

    • @aerotwist
      @aerotwist  6 лет назад

      It really depends on where the code is hosted. Normally I have a "release" script that bumps the version (normally patch given that I deploy lots!) and does whatever the deploy process is, which is -- say -- push to GitHub pages, or Google Cloud or whatever. Sometimes the deploy is to package with Docker and deploy that. It really depends.

  • @DenisTRUFFAUT
    @DenisTRUFFAUT 5 лет назад

    Handle typescript, dynamic imports (experimentalCodeSplitting) and minification (terser)
    import typescript from 'rollup-plugin-typescript2';
    import { terser } from 'rollup-plugin-terser';
    let defaults = { compilerOptions: { declaration: true } };
    let override = { compilerOptions: { declaration: false } };
    export default {
    input: ['app/js/index.ts'],
    output: [
    {
    dir: 'public',
    format: 'es',
    sourcemap: false
    },
    ],
    plugins: [
    typescript({
    tsconfigDefaults: defaults,
    tsconfig: 'tsconfig.json',
    tsconfigOverride: override
    }),
    terser()
    ],
    experimentalCodeSplitting: true,
    };

  • @MH-ix2nh
    @MH-ix2nh 4 года назад

    I am on windows, what should I use instead of rsync?

  • @zeocamo
    @zeocamo 5 лет назад +1

    Adv. version please, i love to see others build tools

  • @michongoma7598
    @michongoma7598 6 лет назад

    Hi paul! I like the background music

  • @jimfoley2690
    @jimfoley2690 3 года назад

    Oops clicked on one of your video’s by mistake oops me thinks this isn’t Paul Irish. Best mistake I have made in a long time. Naming my events Womble extends Wobble

  • @rohankalanje
    @rohankalanje 6 лет назад

    English version of Dean Pelton from community! The resemblance is uncanny!

    • @aerotwist
      @aerotwist  6 лет назад +2

      I have no idea who that is! 😂

  • @DrRobrez
    @DrRobrez 5 лет назад

    Does that string interpolation in the log function work in old browsers?

    • @aerotwist
      @aerotwist  5 лет назад +1

      Depends on what you mean by old. IE, no, but I think every other browser yes

  • @HenriqueRamosLimas
    @HenriqueRamosLimas 6 лет назад

    Great video as always, that is perfect for starting up without losing a lot of time figuring out how to build stuff. What about css files, do you use some build process for concatenate them or just use one single styles and have fun with it? I suppose you do not use some preprocessor for that kind of projects, is that right?

    • @aerotwist
      @aerotwist  6 лет назад

      Right. If I did it would be Sass, but even then I keep it minimal, like importing mostly

    • @HenriqueRamosLimas
      @HenriqueRamosLimas 6 лет назад

      @@aerotwist Coolio, make sense. Maybe it's more advanced setup, but what about watch settings? Do you use nodemon for that?

    • @aerotwist
      @aerotwist  6 лет назад +1

      I tend not to watch, honestly. I find I do a heap of changes and want to refresh completely.

    • @HenriqueRamosLimas
      @HenriqueRamosLimas 6 лет назад

      @@aerotwist I see, make sense them. It seems a pretty smart way actually, because you need to be confident that your change will work. That is not my case :)
      Thanks for the suggestions Paul, really great content.

  • @matteobagni1235
    @matteobagni1235 6 лет назад

    I lately found out that parcel is really removing a lot of overhead for very simple things, like prototyping.

    • @aerotwist
      @aerotwist  6 лет назад

      Definitely. I found it hard to configure and extend, and if it doesn't fit you might struggle, but yeah if you fit the bill then it's a great choice!

  • @andyorlov4023
    @andyorlov4023 6 лет назад

    Instead of http-server i prefer python SimpleHTTPServer, because it built in OS (linux) and don't need install yet another node package :D

    • @aerotwist
      @aerotwist  6 лет назад

      The challenge I've had with that is when the folder is recreated it gets confused, it doesn't support gzip, and it has been known to hang for me on Mac. Hopefully it plays nicely for you!

  • @rajashekhar433
    @rajashekhar433 5 лет назад

    Please create a videos on How to create chrome extension using webpack or roll up, Vue, React. Please

  • @MartinThierer
    @MartinThierer 5 лет назад

    I think just adding --delete as an option to rsync should be equivalent to deleting the build directory.

  • @HashimWarren
    @HashimWarren 6 лет назад

    I'm taking a whole course on Webpack because I feel like I should just bite the bullet and get good at the thing. I'm a web dev beginner

  • @venomneko
    @venomneko 6 лет назад

    What are your thoughts on ParcelJS?

    • @aerotwist
      @aerotwist  6 лет назад

      It's great. It's also magical, and I like magic when it works. When I need to go custom it is less good for me personally.

  • @sumukhshirodker7358
    @sumukhshirodker7358 5 лет назад

    Hey paul can u tell me how to hide "X-powered by Express" in network devtools in chrome

    • @aerotwist
      @aerotwist  5 лет назад

      Sounds like a header that express is adding. You'd need to delete the header on the server side

    • @sumukhshirodker7358
      @sumukhshirodker7358 5 лет назад

      @@aerotwist So should I say app.set("X-powered-by",false)

    • @aerotwist
      @aerotwist  5 лет назад

      If that's how you unset a header, yep. TBH I've not done it in a while

    • @MartinThierer
      @MartinThierer 5 лет назад

      app.disable('x-powered-by');
      (see expressjs.com/en/4x/api.html#app.settings.table)

  • @nunofaria11
    @nunofaria11 6 лет назад

    What is your criteria on using single quotes vs double quotes?

    • @aerotwist
      @aerotwist  6 лет назад

      Be consistent 👍 I fail at that sometimes! 😂

  • @robinlinus8675
    @robinlinus8675 5 лет назад

    For the sake of minimalism I like to use no build tools whenever possible.
    For example github.com/robinlinus/snapdrop/

  • @rongsenng
    @rongsenng 6 лет назад

    `process.env.npm_package_version` is another way to retrieve the version tag.

    • @aerotwist
      @aerotwist  6 лет назад

      I tried and couldn't get it to work :(

  • @MrHelmudt
    @MrHelmudt 6 лет назад

    You should check poi.js. It is project started as a quick start for Vue.js with minimum configuration, but it is so much more powerfull. You can run react apps on it, typescript works well with just one plugin installed. github.com/grzegorzmoskal/webapp-boilerplate/ check out this repo i worked with my friend. It has everything you want for a serverless app, but has close to zero config of Poi.js

  • @liqudtags
    @liqudtags 5 лет назад

    Yarn would have been about 10x faster 😏😘

  • @ddevile01
    @ddevile01 6 лет назад

    So service workers next?

    • @aerotwist
      @aerotwist  6 лет назад

      A nice quick topic 😂👍

    • @AndrewBone
      @AndrewBone 6 лет назад

      @@aerotwist you could make a playlist, how exciting's that?

  • @glashio
    @glashio 6 лет назад

    npm install #time 💖 it

    • @aerotwist
      @aerotwist  6 лет назад +1

      It's a lot better than it used to be, but I couldn't resist a little nod to it.

    • @glashio
      @glashio 6 лет назад

      i left nodejs and went to golang backend/webserver with webcomponents.org... but wait WebAssembly in Go :) #lovethisvideos

  • @rinatvaliullov3247
    @rinatvaliullov3247 6 лет назад

    Can you share your codes in github?

    • @aerotwist
      @aerotwist  6 лет назад

      Eventually! Though in this case there really isn't anything to share?

    • @rinatvaliullov3247
      @rinatvaliullov3247 6 лет назад

      You don't show all steps. And I think it will be hard to setup all stuff correctly for novices. Or, you can show all steps simply.

  • @jacobpjohnson
    @jacobpjohnson 6 лет назад

    "i'll link it below"... uh where?

    • @aerotwist
      @aerotwist  6 лет назад

      What did I forget to link?

    • @jacobpjohnson
      @jacobpjohnson 6 лет назад

      rollup documentation and npm

    • @aerotwist
      @aerotwist  6 лет назад

      They're in the description, bud

    • @jacobpjohnson
      @jacobpjohnson 6 лет назад

      RIP. I clicked show more and nothing loaded. Thanks obama.

    • @aerotwist
      @aerotwist  6 лет назад

      Is it working now? That's a bummer if not!