Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 03:03
    webpack-bot labeled #15239
  • 03:03
    dependabot[bot] labeled #15239
  • 03:03
    dependabot[bot] opened #15239
  • 03:03

    dependabot[bot] on npm_and_yarn

    chore(deps-dev): bump webpack-c… (compare)

  • 03:03

    dependabot[bot] on npm_and_yarn

    chore(deps-dev): bump eslint-pl… (compare)

  • 03:03

    dependabot[bot] on npm_and_yarn

    (compare)

  • 03:03
    dependabot[bot] closed #15178
  • 03:02
    webpack-bot labeled #15238
  • 03:02
    dependabot[bot] labeled #15238
  • 03:02
    dependabot[bot] opened #15238
  • Jan 24 03:06
    webpack-bot labeled #15234
  • Jan 24 03:06
    webpack-bot labeled #15235
  • Jan 24 03:04
    dependabot[bot] opened #15234
  • Jan 24 03:04
    dependabot[bot] opened #15235
  • Jan 24 03:04

    dependabot[bot] on npm_and_yarn

    chore(deps-dev): bump lint-stag… (compare)

  • Jan 24 03:03
    dependabot[bot] closed #15216
  • Jan 24 03:03

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jan 24 03:03

    dependabot[bot] on npm_and_yarn

    chore(deps-dev): bump @babel/co… (compare)

  • Jan 24 03:02
    webpack-bot labeled #15233
  • Jan 24 03:02

    dependabot[bot] on npm_and_yarn

    chore(deps-dev): bump simple-gi… (compare)

Luke Abby
@DavidArchibald
did the commenter's point about polyfilling help at all?
regarding the buffer issue
Also are you able to traceback the error better? An internal server error could happen for many reasons, if you've updated dependencies besides webpack that could do it or if they worked with some other polyfills that suddenly don't exist etc
Gabriel Ayham Semaan
@Gabson1
I wasn't quite sure how to implement the fallback for buffer... my way did not work unfortunately

Webpack mentions that not the full error message is being displayed,

1 WARNING in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details) 1 warning has detailed information that is not shown. Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

however whatever I try, I can't get webpack to spit out some more info

Luke Abby
@DavidArchibald
iirc you have to do this:
module.exports = {
  //...
  stats: {
    children: true,
  },
};
might actually be different
Gabriel Ayham Semaan
@Gabson1
it's exactly what I tried, lemme do it one more time
Webpack still outputs the same message and no more details for my errors
Luke Abby
@DavidArchibald
What's your node version
Gabriel Ayham Semaan
@Gabson1
v14.15.4
npm is 6.14.10 if you want this info as well
Luke Abby
@DavidArchibald
I presume you tried errorDetails as well?
Gabriel Ayham Semaan
@Gabson1
yes
Luke Abby
@DavidArchibald
Yeah not sure what's going wrong with stats.children: webpack/webpack#12653
it's obstensibly fine in this issue and up to date documentation references it
Gabriel Ayham Semaan
@Gabson1
I know, my IDE even suggest all the additional options I have for outputting the stats
Luke Abby
@DavidArchibald
At this point it seems you're partially on the burden of large code and config. Could you strip out as much as you absolutely can from your configs and your code until you've gotten it down to the smallest amount that reproduces the problem? Traceback and everything is being especially tricky so what's superflous and what's not matters, including minimal code etc. This sounds like it's probably an error or several with dependent things. I'd suggest making an actual repo instead of a gist if possible as you'll want to include a package.json etc.
The problem has become a needle in a haystack and you're most well equipped to tear away at superflous stuff until you need help again.
Gabriel Ayham Semaan
@Gabson1
Hmm ok, then I will do just that. I hoped it might be something suer obvious :P
Thanks for your suggestion, I'll do that this evening.
Luke Abby
@DavidArchibald
Doesn't seem to be since it's indirected by several layers of lack of traceability
gotcha
Jonas Schumacher
@jonasmerlin
Hey! Quick question: the https://github.com/webpack-contrib/node-loader README stated that "node-loader only works on the node/electron-main/electron-main targets." Should that second electron-main read electron-renderer?
Luke Abby
@DavidArchibald
most likely. The easiest way to see would be to try if you need to.
James Bromwell
@thw0rted
Does anybody have tips for looking at build performance? I just did a big dep update yesterday, a couple of loaders had major-version updates, and I'm pretty sure my prod build time is roughly double what it was before. How can I tell what's taking so long?
Luke Abby
@DavidArchibald
I'd start with the speed-measure-plugin as a good starting point
From there you'll have to figure out what parts of the plugin are running slower which will be a bit harder
James Bromwell
@thw0rted
I think I looked at that a while back, they were taking a really long time to add Webpack 5 support. The NPM page you linked still says "all versions (1,2,3 and 4)"
James Bromwell
@thw0rted
Am trying it anyway, will see what happens
James Bromwell
@thw0rted

OK, first try failed. I have a webpack.base.js and webpack.prod.js. Prod imports a partial config from base, then uses webpack-merge to export the final combined options. I had export default WebpackMerge(baseConfig, prodConfig). I replaced this with

const merged = WebpackMerge(baseConfig, prodConfig);
const smp = new SpeedMeasurePlugin();
export default smp.wrap(merged);

As far as I can tell, that's supposed to work. Instead, I get errors for all CSS files that look like

Error: You forgot to add 'mini-css-extract-plugin' plugin (i.e. `{ plugins: [new MiniCssExtractPlugin()] }`)

but of course the prodConfig has that entry in plugins -- otherwise the build without SMP would not work

I'm re-running the old version, without SMP, just as a sanity check, but the build takes about 7 minutes now, which is of course why I'm trying to profile it in the first place
confirmed, it did work without SMP
James Bromwell
@thw0rted
OK, I made sure to console.log(merged) just to be absolutely sure that the resulting options-object has a plugins array that contains a MiniCssExtractPlugin instance, and it definitely does, so it feels like this is a webpack 5 support problem. The relevant issue is stephencookdev/speed-measure-webpack-plugin#149 which hasn't seen much activity, sadly
David Anderson
@yowzadave
Is it possible to create a webpack loader that can import all of the files in a directory? I've created a file "format" which is actually just a folder with files in it; the directory has an extension like file.myformat but is actually just a directory.
I get a "Module not found" error when attempting to import, i.e.
import file from "file.myformat"
David Anderson
@yowzadave
I could turn the format into a zip file...but I was hoping to not have to turn it into a binary file type
David Anderson
@yowzadave
to clarify the above—the "Module not found" error seems to be thrown before my loader function is ever even called
James Bromwell
@thw0rted
What you want is called a context
Webpack will try to Get Clever with the arguments you pass to the context method and create assets for all the matching files at build-time. The Context you get back has keys for each filename that matched, and calling myContext("./matching_file.name") returns the same thing as require("./context_path/matching_file.name") would have
(I just noticed that's from 2 hours ago, hopefully @yowzadave is still around)
David Anderson
@yowzadave
hi @thw0rted thanks! yes, still around
James Bromwell
@thw0rted
super simple example:
const imageDir = require.context("./images", /\.png$/);
const someImage = imageDir("./foo.png"); // same value as require("./images/foo.png")
Marc Martino
@marcmartino
const path = require('path');

var config = {

  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/,
      },
    ],
  },
  resolve: {
    extensions: ['.tsx', '.ts'],
  },
  optimization: {}

};

module.exports = module.exports = (env, argv) => {

  if (argv.type === 'sheets') {

    config.entry = './src/sheets.entry.ts'
    config.output = {
      library: 'sub',
      // libraryTarget: 'var',
      filename: 'index.js',
      path: path.resolve(__dirname, 'dist/sheets'),
    }
    config.target = "web"
    config.optimization.minimize = false
    config.module.rules = [...config.module.rules,
    {
      test: require.resolve("moduleName"),  // here
      use: 'exports-loader?SACCHARIDEPAIRSTABLE'
    }]
  }

  if (argv.type === 'module') {
    config.entry = './src/index.ts'
    config.output = {
      library: 'subs',
      libraryTarget: 'window',
      filename: 'index.js',
      path: path.resolve(__dirname, 'dist/module'),
    }
  }

  return config;
};
i'm struggling to figure out what the value i'm supposed to put on L36 with the call to require.resolve. this is a webpack4 project.
really i'm just trying to find a way to globally expose a function or two from my project when i run webpack
Luke Abby
@DavidArchibald
I'd suggest against globally exposing things mainly because the main point of Webpack is to make imports/exports easier. Regardless your problem is that to my understanding exports-loader adds exports to a file where they didn't exist in any capacity. I believe you'd like to try Provide Plugin if you want something globally available.
axin_dev
@axin_dev:matrix.org
[m]
If the same module is imported in multiple places with different webpackChunkName, different chunks will be generated for the same module? or if the same chunk will be generated, how it will be named 😅
joelchen
@joelchen
How do I access JWT protected remote modules via Module Federation?
Gina G-R
@ginagr
Hello! Does anyone know how to use webpack 5 with heroku? Heroku relies on setting the process.env.PORT variable after the app is built, but with webpack 5 I can only set the process.env variables during the build with webpack.DefinePlugin