jantimon/html-webpack-plugin

Support `__dirname` in JavaScript bundle

timfish opened this issue · 3 comments

It appears that there were some changes to improve support for SSR but this didn't include the addition of __dirname.

I've hit this myself in a slightly different context when messing around with Webpack + Electron which can have full nodejs in the browser. If your JavaScript bundle contains __dirname, you get an error in evaluateCompilationResultsaying that__dirname is not defined. I'm currently working around this with dirname(__filename)`.

Ah, and nearly forgot to say... happy to do a PR but not entirely sure what to set __dirname as!

adding support for __dirname sounds nice - you might also use __non_webpack_require__ inside your template to load pure js files with full support for __filename and __dirname

stale commented

This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days.