These are chat archives for webpack/webpack

Sep 2018
Sep 08 2018 01:04
Rob Halff
Sep 08 2018 12:10
Anyone knows an example repository for React and webpack 4? My setup works fine, but want to check if I'm totally up to date or not.
Sep 08 2018 12:44
Hi all, I'm trying to get responses for a small survey about agile methodologies. I would be very happy if you can participate. It's a one minute survey and would be great to have more data points.
Sep 08 2018 13:43
Doing changes to my import "./stylus/index.styl"; don't trigger HMR, it thinks there aren't any changes in my Stylus file... Solutions?
Andrey Ilichev
Sep 08 2018 15:07
Hi everyone, does somebody know why for the last time in most code snippets on webpack docs I see red- and green-signed lines, just like it's git diff? Can I turn it off?
Sep 08 2018 18:28

How can I use two different entry points which rely on the same node_modules and have it include the node_modules in a vendor bundle for each entry point?

It would appear that once it's included in one bundle, it's left out of the other

reuseExistingChunk: false doesn't appear to make a difference
Sep 08 2018 19:43
Hello webpack people
Ingwie Phoenix
Sep 08 2018 19:43
Sep 08 2018 19:49
I'm looking for some advice on a project I'm working on. I'm currently participating in the js13k competition and have a situation where I have a server.js, client.js and shared.js file. I'm not allowed to rename these files and so I've configured webpack to treat them all as an entrypoint and export into a dist folder with the same names. Currently in order to keep filesize as small as possible (as the competition specifies you cannot exceed 13kbs between server / client / shared files) I have everything in shared.js existing on the window / globals object so my node server and the browser can use these as though they existed in the same file. I know the ideal thing to do would be to import the shared module into the client / server js files with webpack, but then I would have redundant code between the two and the original shared.js file as well D:
Is there some way to tell webpack that I would like a given file to not be wrapped in an IIFE, but rather be exposed to either the globals context of node or the window object of a browser
Sorry for the long paragraph there, I figured without that context it would seem obvious that I should be using imports, but in my current situation that would not be ideal.
TL;DR - For reasons stated above I want to expose a webpacked file to the global / window scope. Is this possible and how can I achieve this?
Ingwie Phoenix
Sep 08 2018 20:01
It has been a long time since I’ve worked with Webpack - but here is what I think: There was a Bundle plugin that would allow you to use a file as a shared resource for many bundles.
Now, you probably want to only distribute the client.js and keep that one as minimal as possible.
Import the shared.js into client.js and see if you can utilize tree-shaking.
Next, have it mini- and optimized by another plugin - jsmin or something.
for server.js, you can just import that too.
Unfortunately, i can’t give you precice steps...
Sep 08 2018 20:05
Thanks for the input
I am currently using uglify to keep it small
and unfortunately in my case my shared.js only contains code that is utilized by both the server and client so tree shaking unfortunately wont help me :/
Ingwie Phoenix
Sep 08 2018 20:21
The generated, webpacked client.js file will only contain functions that it really needs
Therefore it should be smaller…much smaller.
Sep 08 2018 20:27
I found a non webpack solution :D
I wrapped everything in my shared class in an IIFE bound to the window object
Ingwie Phoenix
Sep 08 2018 20:28
Ohh okay.
Sep 08 2018 20:30
so I was able to do
(function() {

this.Wall = class extends Entity {

and when minified its bound to global so this will always be either the node global or window
Amr Daoud
Sep 08 2018 23:11
hi 70th