ERROR:
Html Webpack Plugin: Error: webpack://webpack/data:text/javascript,webpack_public_path_=webpack_base_uri=_htmlWebpackPl uginPublicPath;?:2 webpack_require.p = webpack_base_uri = htmlWebpackPluginPublicPath; ^
ReferenceError: webpack_base_uri is not defined
javascript,webpack_public_path_=webpack_base_uri=htmlWebpackPluginPublicPath;?:2 eval webpack://webpack/data:text/javascript,webpack_public_path=webpack_base_uri=_htmlWebpackPluginP ublicPath;?:2:46
index.html:30 Object.data:text/javascript,webpack_public_path = webpack_base_uri = htmlWebpackPlug inPublicPath; C:/Users/Ymtx/Desktop/vue/webpack/src/index.html:30:1
index.html:53 webpack_require C:/Users/Ymtx/Desktop/vue/webpack/src/index.html:53:41
I didn't know why it was happended,and i have read many blog,but there were few blog about it.I do want to do with it.Please help me.
code ↓
var webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const htmlPlugin = new HtmlWebpackPlugin({
template:'./src/index.html',
filename:'index.html',
})
module.exports = {
mode:"development",
entry:path.join(__dirname,'./src/index.js'),
output:{
path:path.join(__dirname,'./dist'),
filename:'bundle.js'
},
plugins:[htmlPlugin]
}
package.json
{
"name": "webpack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack-dev-server --open --host --127.0.0.1 --port 8888"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"jquery": "^3.6.0"
},
"devDependencies": {
"css-loader": "^5.2.4",
"html-webpack-plugin": "^5.3.1",
"style-loader": "^2.0.0",
"vue": "^2.6.12",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.1.14"
}
}
Try to add plugin in webpack config: