inheriting cwd webpack and maxBuffer to int parse
- inheriting from webpack context if it's not defined
- parseInt for maxBuffer
Hi @oleg-andreyev thank you for your contribution! I'm sorry for the late response. I somehow missed the notification.
Could you explain to me the use case for this change, and why it's necessary to change options inside this plugin rather than passing them in from the Webpack config?
@localjo
- I'm calling "shell script" which iterates over twig templates and combines then into single file and size of this "prepared" files easily overflow default
maxBuffer(1024 * 1024) cwdis actually inherited from webpack context because to ensure thatexeccan find this script ❓
Why it's done like so? We're migrating our project from Symfony 3.4 to 4.4 and we used use AsseticBundle (which is not deprecated) but we still use JMSTwigJsBundle.
Our entrypoint looks like this:
require('shell-loader?script=./twig-templates.sh&maxBuffer=4194304!./twig-templates.sh');
I'm not familiar with using require syntax for setting up a Webpack plugin. Can you share some documentation for this approach?
Do you have a Webpack config file? If so, can you try passing maxBuffer from there. In order for the script to be found, you can pass the path into script in the Webpack config too, or configure a shortcut to it in package.json. Would this work in your Webpack config?
module: {
rules: [
{
test: /.*\.twig$/,
use: [{ loader: 'shell-loader', options: {
script: './twig-templates.sh',
maxBuffer: 4194304
}} ]
}
]
}
(Note: I'm not familiar with Twig or Symfony, so I don't know what the test should be.)
@localjo here is the documentation about inline loaders: https://webpack.js.org/concepts/loaders/#inline
Thanks. I'll take a look. I'm feeling a bit under the weather right now, so it might take me awhile to get to this. Any part of your code that you can share with me will help as well. Thanks!