TypeError: require(...) is not a function
I'm guessing this is a problem with PostHTML itself. I've tried using both posthtml().use().process() and posthtml.process() with no avail, every syntactic approach just leads to the require related error.
Every time I use PostHTML in module.rules.options.preprocessor as defined in the html-loader documentation, I get the error as defined above.
Expected Behavior
The loader should execute the preprocessor function correctly on all HTML pages it receives.
How Do We Reproduce?
https://github.com/azan-n/posthtml-loader-require-bug
has a reproduction of the issue with both html-loader config and posthtml-loader configuration in the same webpack.config.js of which the posthtml-loader config is commented out.
Please paste the results of npx webpack-cli info here, and mention other relevant information
Bug report
Similar to https://github.com/posthtml/posthtml-loader/issues/132 using PostHTML causes the following error:
Actual Behavior
Every time I use PostHTML in
module.rules.options.preprocessor
as defined in the html-loader documentation, I get the error as defined above.Expected Behavior
The loader should execute the preprocessor function correctly on all HTML pages it receives.
How Do We Reproduce?
https://github.com/azan-n/posthtml-loader-require-bug has a reproduction of the issue with both
html-loader
config andposthtml-loader
configuration in the samewebpack.config.js
of which theposthtml-loader
config is commented out.Please paste the results of
npx webpack-cli info
here, and mention other relevant informationSystem: OS: Linux 5.13 Ubuntu 20.04.3 LTS (Focal Fossa) CPU: (4) x64 Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz Memory: 830.10 MB / 7.65 GB Binaries: Node: 16.13.0 - /opt/node/bin/node npm: 8.1.4 - /opt/node/bin/npm Browsers: Chrome: 98.0.4758.102 Firefox: 97.0 Packages: html-loader: ^3.1.0 => 3.1.0 html-webpack-plugin: ^5.5.0 => 5.5.0 posthtml-loader: ^2.0.1 => 2.0.1 webpack: ^5.69.0 => 5.69.0 webpack-cli: ^4.9.2 => 4.9.2