How to fix this?
Html Webpack Plugin:
Error: client\dist\index.html:33
__webpack_require__.p = __webpack_base_uri__ = htmlWebpackPluginPublicPath;
^
ReferenceError: __webpack_base_uri__ is not defined
- index.html:33 Object.data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;
client/dist/index.html:33:46
- index.html:56 __webpack_require__
client/dist/index.html:56:41
- index.html:83
client/dist/index.html:83:11
- index.html:85
client/dist/index.html:85:12
- index.js:144 HtmlWebpackPlugin.evaluateCompilationResult
[client]/[html-webpack-plugin]/index.js:144:28
- index.js:342
[client]/[html-webpack-plugin]/index.js:342:26
- runMicrotasks
- task_queues.js:93 processTicksAndRejections
internal/process/task_queues.js:93:5
- async Promise.all
module.exports = {
entry : [ './src/render.tsx' ],
module : { rules: [ { test: /\.(ts|tsx)$/, use: [ { loader: 'ts-loader', options:{transpileOnly:true}} ]} ] },
resolve : {
extensions: ['.js', '.jsx','.json', '.ts', '.tsx'],
fallback: {
"fs": false,
"tls": false,
"net": false,
"path": false,
"zlib": false,
"http": false,
"https": false,
"stream": false,
"crypto": false,
"buffer": false,
}
},
mode : 'development',
devtool : 'inline-source-map',
devServer : {
contentBase: './dist',
hot: true,
open: true,
},
plugins : [
new (require('html-webpack-plugin'))({ template : 'dist/index.html'})
]
}
Please upgrade webpack to fix this issue :)
This issue is because of html-webpack-plugin - it currently asks for a peer of "webpack": "^5.20.0" but __webpack_base_uri__ was added in 5.21.0. (https://webpack.js.org/api/module-variables/#__webpack_base_uri__-webpack-specific). Would be an easy fix.
my webpack.config.js code is ok ,
__webpack_base_uri__ = 'http://localhost:8080';
鈥媍onst htmlWebpackPlugin = require('html-webpack-plugin')
Most helpful comment
Please upgrade webpack to fix this issue :)